From 349671a722c61d7f819e0b45ee79df9728b369a3 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 1 May 2020 11:28:18 +0200 Subject: [PATCH] Fix #8845: Strip annots from proto when checking SAM --- compiler/src/dotty/tools/dotc/core/Types.scala | 2 ++ tests/pos/i8845.scala | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/pos/i8845.scala diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index b3629dc2386b..6b497c0b495e 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -4728,6 +4728,8 @@ object Types { zeroParamClass(tp.underlying) case tp: TypeVar => zeroParamClass(tp.underlying) + case tp: AnnotatedType => + zeroParamClass(tp.underlying) case _ => NoType } diff --git a/tests/pos/i8845.scala b/tests/pos/i8845.scala new file mode 100644 index 000000000000..52e41cbc9605 --- /dev/null +++ b/tests/pos/i8845.scala @@ -0,0 +1,8 @@ +trait IntToLong: + def apply(v: Int) : Long + +inline def convert1( f: IntToLong) = ??? +inline def convert2(inline f: IntToLong) = ??? + +val test1 = convert1(_ * 10) +val test2 = convert2(_ * 10)