diff --git a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala index 18b028d1a024..c18009784ba9 100644 --- a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala +++ b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala @@ -471,6 +471,8 @@ object GenericSignatures { foldOver(tp.typeParams.nonEmpty, parents) case AnnotatedType(tpe, _) => foldOver(x, tpe) + case ExprType(tpe) => + true case tp => foldOver(x, tp) } diff --git a/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala b/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala index 0fa91c3b6879..9d6ff413f8a2 100644 --- a/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala +++ b/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala @@ -32,6 +32,22 @@ class TestBCode extends DottyBytecodeTest { } } + @Test def byNameParameters = { + val source = """ + |class Foo { + | def byNameParam(str: => String): Unit = {} + |} + """.stripMargin + + checkBCode(source) { dir => + val clsIn = dir.lookupName("Foo.class", directory = false).input + val clsNode = loadClassNode(clsIn) + val methodNode: MethodNode = getMethod(clsNode, "byNameParam") + + assert(methodNode.signature == "(Lscala/Function0;)V") + } + } + /** This test verifies that simple matches are transformed if possible * despite no annotation */ @@ -957,7 +973,7 @@ class TestBCode extends DottyBytecodeTest { @Test def invocationReceivers(): Unit = { - import Opcodes._ + import Opcodes.* checkBCode(List(invocationReceiversTestCode.definitions("Object"))) { dir => val c1 = loadClassNode(dir.lookupName("C1.class", directory = false).input)