From d74a18a57838c9424cbaee7b00d9ab87f1a884c5 Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Thu, 23 Jan 2020 10:33:36 +0100 Subject: [PATCH 1/2] Add test --- tests/run/i7990/Exception_1.java | 7 +++++++ tests/run/i7990/Test_2.scala | 1 + 2 files changed, 8 insertions(+) create mode 100644 tests/run/i7990/Exception_1.java create mode 100644 tests/run/i7990/Test_2.scala diff --git a/tests/run/i7990/Exception_1.java b/tests/run/i7990/Exception_1.java new file mode 100644 index 000000000000..6ee8500775ff --- /dev/null +++ b/tests/run/i7990/Exception_1.java @@ -0,0 +1,7 @@ +public class Exception_1 { + public Exception_1(T actual, T matcher) { + } + + public Exception_1(String message) { + } +} diff --git a/tests/run/i7990/Test_2.scala b/tests/run/i7990/Test_2.scala new file mode 100644 index 000000000000..baca4b8c4066 --- /dev/null +++ b/tests/run/i7990/Test_2.scala @@ -0,0 +1 @@ +@main def Test = Exception_1("error") From 40edbd06358b4669c18c992092a02b688120fb76 Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Thu, 23 Jan 2020 10:38:00 +0100 Subject: [PATCH 2/2] Fix #7990: handle PolyType in constructor normalization --- .../tools/dotc/core/classfile/ClassfileParser.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 6b85cec70d7a..7d2f265fe4c9 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -271,9 +271,14 @@ class ClassfileParser( * and make constructor type polymorphic in the type parameters of the class */ def normalizeConstructorInfo() = { - val mt @ MethodType(paramNames) = denot.info val rt = classRoot.typeRef appliedTo (classRoot.typeParams map (_.typeRef)) - denot.info = mt.derivedLambdaType(paramNames, mt.paramInfos, rt) + + def resultType(tpe: Type): Type = tpe match { + case mt @ MethodType(paramNames) => mt.derivedLambdaType(paramNames, mt.paramInfos, rt) + case pt : PolyType => pt.derivedLambdaType(pt.paramNames, pt.paramInfos, resultType(pt.resType)) + } + + denot.info = resultType(denot.info) addConstructorTypeParams(denot) }