Skip to content

Commit a6de861

Browse files
committed
Fix #7746: Turn assertion into error
1 parent 9aa7991 commit a6de861

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,10 +1104,9 @@ class Typer extends Namer
11041104
TypeTree(targetTpe)
11051105
case _ =>
11061106
if (mt.isParamDependent)
1107-
throw new java.lang.Error(
1107+
errorTree(tree,
11081108
i"""internal error: cannot turn method type $mt into closure
1109-
|because it has internal parameter dependencies,
1110-
|position = ${tree.span}, raw type = ${mt.toString}""") // !!! DEBUG. Eventually, convert to an error?
1109+
|because it has internal parameter dependencies""")
11111110
else if ((tree.tpt `eq` untpd.ContextualEmptyTree) && mt.paramNames.isEmpty)
11121111
// Note implicitness of function in target type since there are no method parameters that indicate it.
11131112
TypeTree(defn.FunctionOf(Nil, mt.resType, isContextual = true, isErased = false))

tests/neg/i7746.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class A {
2+
def foo = (x : Int, y => x) => () // error // error
3+
}

0 commit comments

Comments
 (0)