Skip to content

Commit 2dd9f45

Browse files
committed
In type assigner for Apply, carry ErrorType's from the fn.
This was already done for `TypeApply` in cecfb61. We apply the same logic for `Apply` nodes.
1 parent c8b4da8 commit 2dd9f45

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ trait TypeAssigner {
297297
else fntpe.resultType // fast path optimization
298298
else
299299
errorType(em"wrong number of arguments at ${ctx.phase.prev} for $fntpe: ${fn.tpe}, expected: ${fntpe.paramInfos.length}, found: ${args.length}", tree.srcPos)
300+
case err: ErrorType =>
301+
err
300302
case t =>
301303
if (ctx.settings.Ydebug.value) new FatalError("").printStackTrace()
302304
errorType(err.takesNoParamsMsg(fn, ""), tree.srcPos)
@@ -563,5 +565,3 @@ object TypeAssigner extends TypeAssigner:
563565
def seqLitType(tree: untpd.SeqLiteral, elemType: Type)(using Context) = tree match
564566
case tree: untpd.JavaSeqLiteral => defn.ArrayOf(elemType)
565567
case _ => if ctx.erasedTypes then defn.SeqType else defn.SeqType.appliedTo(elemType)
566-
567-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import scala.compiletime.*
2+
3+
object Inlines:
4+
inline def testInline[A](): Boolean =
5+
inline erasedValue[A] match
6+
case _: Tuple =>
7+
constValue[Tuple.Size[A & Tuple]] == 2
8+
case _ =>
9+
false
10+
end Inlines
11+
12+
case class Foo2(x: Boolean, y: String)
13+
case class Foo3(x: Boolean, y: String, z: Int)
14+
15+
object Test:
16+
def main(args: Array[String]): Unit =
17+
// Note: the assert's don't do anything since it's a pos test; they show intent (and pass if we run the test)
18+
assert(!Inlines.testInline[Foo2]())
19+
assert(!Inlines.testInline[Foo3]())
20+
assert(Inlines.testInline[(Boolean, String)]())
21+
assert(!Inlines.testInline[(Boolean, String, Int)]())
22+
end Test

0 commit comments

Comments
 (0)