Skip to content

Commit 8ac74d5

Browse files
committed
Fix #8845: Strip annots from proto when checking SAM
1 parent 37bc11d commit 8ac74d5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ class Typer extends Namer
11701170
if (tree.tpt.isEmpty)
11711171
meth1.tpe.widen match {
11721172
case mt: MethodType =>
1173-
pt match {
1173+
pt.stripAnnots match {
11741174
case SAMType(sam)
11751175
if !defn.isFunctionType(pt) && mt <:< sam =>
11761176
// SAMs of the form C[?] where C is a class cannot be conversion targets.

tests/pos/i8845.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait IntToLong:
2+
def apply(v: Int) : Long
3+
4+
inline def convert1( f: IntToLong) = ???
5+
inline def convert2(inline f: IntToLong) = ???
6+
7+
val test1 = convert1(_ * 10)
8+
val test2 = convert2(_ * 10)

0 commit comments

Comments
 (0)