File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/typer
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1701,7 +1701,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
17011701 case mt : MethodType =>
17021702 pt.findFunctionType match {
17031703 case SAMType (samMeth, samParent)
1704- if ! defn.isFunctionNType(samParent) && mt <:< samMeth =>
1704+ if ! ctx.erasedTypes && ! defn.isFunctionNType(samParent)
1705+ && mt <:< samMeth && ! mt.isImplicitMethod =>
17051706 if defn.isContextFunctionType(mt.resultType) then
17061707 report.error(
17071708 em """ Implementation restriction: cannot convert this expression to ` $samParent`
Original file line number Diff line number Diff line change 1+ abstract class MyFun :
2+ def apply (x : Int ): Int
3+
4+ object Test :
5+ val myFun : MyFun = (x : Int ) ?=> x + 10 // error
You can’t perform that action at this time.
0 commit comments