diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 1 | ||||
-rw-r--r-- | test/files/neg/t5572.check | 11 | ||||
-rw-r--r-- | test/files/neg/t5572.scala | 23 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 9ff86e69eb..8dd2cd4a1d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3579,7 +3579,6 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { val Select(qual, name) = fun tryTypedArgs(args, forArgMode(fun, mode)) match { case Some(args1) => - assert((args1.length == 0) || !args1.head.tpe.isErroneous, "try typed args is ok") val qual1 = if (!pt.isError) adaptToArguments(qual, name, args1, pt, true, true) else qual diff --git a/test/files/neg/t5572.check b/test/files/neg/t5572.check new file mode 100644 index 0000000000..7b1e290861 --- /dev/null +++ b/test/files/neg/t5572.check @@ -0,0 +1,11 @@ +t5572.scala:16: error: type mismatch; + found : B + required: A + Z.transf(a, b) match { + ^ +t5572.scala:18: error: type mismatch; + found : A + required: B + run(sth, b) + ^ +two errors found diff --git a/test/files/neg/t5572.scala b/test/files/neg/t5572.scala new file mode 100644 index 0000000000..2da1209c61 --- /dev/null +++ b/test/files/neg/t5572.scala @@ -0,0 +1,23 @@ +class A +class B + +trait X + +object Z { + def transf(a: A, b: B): X = null +} + +class Test { + + def bar(): (A, B) + + def foo { + val (b, a) = bar() + Z.transf(a, b) match { + case sth => + run(sth, b) + } + } + + def run(x: X, z: B): Unit = () +} |