diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index f2268003132a..84796120f8a1 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1155,8 +1155,8 @@ class Typer extends Namer case _ => if (mt.isParamDependent) errorTree(tree, - i"""internal error: cannot turn method type $mt into closure - |because it has internal parameter dependencies""") + i"""cannot turn method type $mt into closure + |because it has internal parameter dependencies""") else if ((tree.tpt `eq` untpd.ContextualEmptyTree) && mt.paramNames.isEmpty) // Note implicitness of function in target type since there are no method parameters that indicate it. TypeTree(defn.FunctionOf(Nil, mt.resType, isContextual = true, isErased = false)) diff --git a/tests/neg/i6391.scala b/tests/neg/i6391.scala new file mode 100644 index 000000000000..fbe3e770d8ef --- /dev/null +++ b/tests/neg/i6391.scala @@ -0,0 +1,4 @@ +object Test { + def foo(x: String, y: x.type): Any = ??? + val f = foo // error // error: cannot convert to closure +} \ No newline at end of file