Skip to content

Fix #3542: Avoid comparisons between method types and typevars #3727

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
Jan 2, 2018
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
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ class Namer { typer: Typer =>
mdef match {
case mdef: DefDef if mdef.name == nme.ANON_FUN =>
val hygienicType = avoid(rhsType, paramss.flatten)
if (!(hygienicType <:< tpt.tpe))
if (!hygienicType.isValueType || !(hygienicType <:< tpt.tpe))
ctx.error(i"return type ${tpt.tpe} of lambda cannot be made hygienic;\n" +
i"it is not a supertype of the hygienic type $hygienicType", mdef.pos)
//println(i"lifting $rhsType over $paramss -> $hygienicType = ${tpt.tpe}")
Expand Down
5 changes: 5 additions & 0 deletions tests/neg/i3542a.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Foo {
def f()()(implicit ctx: String): Int = ???
def at[T](op: () => T): Unit = ()
at(() => f()) // error: missing ()
}