Skip to content

Commit fa9382a

Browse files
committed
Fix InferExpectedTypeSuite.list
1 parent 0b4e677 commit fa9382a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ trait Applications extends Compatibility {
571571
fail(TypeMismatch(methType.resultType, resultType, None))
572572

573573
// match all arguments with corresponding formal parameters
574-
matchArgs(orderedArgs, methType.paramInfos, 0)
574+
if success then matchArgs(orderedArgs, methType.paramInfos, 0)
575575
case _ =>
576576
if (methType.isError) ok = false
577577
else fail(em"$methString does not take parameters")
@@ -666,7 +666,7 @@ trait Applications extends Compatibility {
666666
* @param n The position of the first parameter in formals in `methType`.
667667
*/
668668
def matchArgs(args: List[Arg], formals: List[Type], n: Int): Unit =
669-
if (success) formals match {
669+
formals match {
670670
case formal :: formals1 =>
671671

672672
def checkNoVarArg(arg: Arg) =
@@ -878,7 +878,9 @@ trait Applications extends Compatibility {
878878
init()
879879

880880
def addArg(arg: Tree, formal: Type): Unit =
881-
typedArgBuf += adapt(arg, formal.widenExpr)
881+
val typedArg = adapt(arg, formal.widenExpr)
882+
typedArgBuf += typedArg
883+
ok = ok & !typedArg.tpe.isError
882884

883885
def makeVarArg(n: Int, elemFormal: Type): Unit = {
884886
val args = typedArgBuf.takeRight(n).toList
@@ -943,7 +945,7 @@ trait Applications extends Compatibility {
943945
var typedArgs = typedArgBuf.toList
944946
def app0 = cpy.Apply(app)(normalizedFun, typedArgs) // needs to be a `def` because typedArgs can change later
945947
val app1 =
946-
if (!success || typedArgs.exists(_.tpe.isError)) app0.withType(UnspecifiedErrorType)
948+
if !success then app0.withType(UnspecifiedErrorType)
947949
else {
948950
if isJavaAnnotConstr(methRef.symbol) then
949951
// #19951 Make sure all arguments are NamedArgs for Java annotations

presentation-compiler/test/dotty/tools/pc/tests/InferExpectedTypeSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class InferExpectedTypeSuite extends BasePCSuite:
5555
|""".stripMargin
5656
)
5757

58-
@Ignore("Not handled correctly.")
5958
@Test def list =
6059
check(
6160
"""|val i: List[Int] = List(@@)

0 commit comments

Comments
 (0)