Skip to content

Fix #6391: Fix error message #8448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions tests/neg/i6391.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Test {
def foo(x: String, y: x.type): Any = ???
val f = foo // error // error: cannot convert to closure
}