Skip to content

Commit 17ae40d

Browse files
Merge pull request #8448 from dotty-staging/fix-#6391
Fix #6391: Fix error message
2 parents f548a18 + b9fa47a commit 17ae40d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,8 @@ class Typer extends Namer
11551155
case _ =>
11561156
if (mt.isParamDependent)
11571157
errorTree(tree,
1158-
i"""internal error: cannot turn method type $mt into closure
1159-
|because it has internal parameter dependencies""")
1158+
i"""cannot turn method type $mt into closure
1159+
|because it has internal parameter dependencies""")
11601160
else if ((tree.tpt `eq` untpd.ContextualEmptyTree) && mt.paramNames.isEmpty)
11611161
// Note implicitness of function in target type since there are no method parameters that indicate it.
11621162
TypeTree(defn.FunctionOf(Nil, mt.resType, isContextual = true, isErased = false))

tests/neg/i6391.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test {
2+
def foo(x: String, y: x.type): Any = ???
3+
val f = foo // error // error: cannot convert to closure
4+
}

0 commit comments

Comments
 (0)