Skip to content

Commit 3d7dc45

Browse files
committed
Inline method
1 parent 60b220e commit 3d7dc45

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,17 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
14591459
val desc = capturedParamsTypes.map(tpe => toTypeKind(tpe)).mkString(("("), "", ")") + functionalInterfaceDesc
14601460
// TODO specialization
14611461
val constrainedType = new MethodBType(lambdaParamTypes.map(p => toTypeKind(p)), toTypeKind(lambdaTarget.info.resultType)).toASMType
1462-
val abstractMethod = symHelper(functionalInterface).samMethod()
1462+
1463+
val abstractMethod = ctx.atPhase(ctx.erasurePhase) {
1464+
val samMethods = toDenot(functionalInterface).info.possibleSamMethods.toList
1465+
samMethods match {
1466+
case x :: Nil => x.symbol
1467+
case Nil => abort(s"${functionalInterface.show} is not a functional interface. It doesn't have abstract methods")
1468+
case xs => abort(s"${functionalInterface.show} is not a functional interface. " +
1469+
s"It has the following abstract methods: ${xs.map(_.name).mkString(", ")}")
1470+
}
1471+
}
1472+
14631473
val methodName = abstractMethod.name.mangledString
14641474
val applyN = {
14651475
val mt = asmMethodType(abstractMethod)

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
284284
toDenot(sym).owner.is(Flags.PackageClass)
285285
}
286286

287-
288-
def samMethod(): Symbol = ctx.atPhase(ctx.erasurePhase) {
289-
val samMethods = toDenot(sym).info.possibleSamMethods.toList
290-
samMethods match {
291-
case x :: Nil => x.symbol
292-
case Nil => abort(s"${sym.show} is not a functional interface. It doesn't have abstract methods")
293-
case xs => abort(s"${sym.show} is not a functional interface. " +
294-
s"It has the following abstract methods: ${xs.map(_.name).mkString(", ")}")
295-
}
296-
}
297-
298287
}
299288

300289
object SelectBI extends DeconstructorCommon[tpd.Tree] {

0 commit comments

Comments
 (0)