diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index c71ad928a7d2..e6ab80afaba5 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -947,8 +947,11 @@ object Types { final def possibleSamMethods(using Context): Seq[SingleDenotation] = { record("possibleSamMethods") atPhaseNoLater(erasurePhase) { - abstractTermMembers.toList.filterConserve(m => - !m.symbol.matchingMember(defn.ObjectType).exists && !m.symbol.isSuperAccessor) + abstractTermMembers.toList.filterConserve { m => + !m.symbol.matchingMember(defn.ObjectType).exists + && !m.symbol.isSuperAccessor + && !m.symbol.isInlineMethod + } }.map(_.current) } @@ -5353,6 +5356,7 @@ object Types { * * - has a single abstract method with a method type (ExprType * and PolyType not allowed!) whose result type is not an implicit function type + * and which is not marked inline. * - can be instantiated without arguments or with just () as argument. * * The pattern `SAMType(sam)` matches a SAM type, where `sam` is the diff --git a/tests/neg/i12555b.scala b/tests/neg/i12555b.scala index 5931bda4ba27..651eb0efb7c6 100644 --- a/tests/neg/i12555b.scala +++ b/tests/neg/i12555b.scala @@ -10,9 +10,9 @@ import Noop.* final case class User(name: String, age: Int) -inline given Noop[User] = a => a +inline given Noop[User] = a => a // error val u = User("hello", 45) @main -def run = println(Noop.noop(u)) // error +def run = println(Noop.noop(u))