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
1701
1701
case mt : MethodType =>
1702
1702
pt.findFunctionType match {
1703
1703
case SAMType (samMeth, samParent)
1704
- if ! defn.isFunctionNType(samParent) && mt <:< samMeth =>
1704
+ if ! ctx.erasedTypes && ! defn.isFunctionNType(samParent)
1705
+ && mt <:< samMeth && ! mt.isImplicitMethod =>
1705
1706
if defn.isContextFunctionType(mt.resultType) then
1706
1707
report.error(
1707
1708
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