From c5f98c00d807f44ab1da0565f584d1c3f398db99 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 28 Jun 2017 10:52:21 +0200 Subject: [PATCH 01/11] Workaround #2797 by removing an assertion --- .../src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 297f7e0f8934..7ce9e3707e05 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -256,7 +256,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val evalue = t.symbol.name.mangledString // value the actual enumeration value. av.visitEnum(name, edesc, evalue) } else { - assert(toDenot(t.symbol).name.is(DefaultGetterName), toDenot(t.symbol).name.debugString) // this should be default getter. do not emmit. + // This is a default getter. do not emmit. } case t: SeqLiteral => val arrAnnotV: AnnotationVisitor = av.visitArray(name) From b6618f61a94b54003518dff8980f9eb3e912cb44 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 28 Jun 2017 19:07:29 +0200 Subject: [PATCH 02/11] Minor spacing & formating --- .../src/dotty/tools/dotc/ast/Desugar.scala | 17 +++++++++-------- .../dotty/tools/dotc/transform/Memoize.scala | 18 +++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 62d7ebddff50..4058e1b5cdc3 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -106,22 +106,23 @@ object desugar { def valDef(vdef: ValDef)(implicit ctx: Context): Tree = { val ValDef(name, tpt, rhs) = vdef val mods = vdef.mods - def setterNeeded = + val setterNeeded = (mods is Mutable) && ctx.owner.isClass && (!(mods is PrivateLocal) || (ctx.owner is Trait)) if (setterNeeded) { - // todo: copy of vdef as getter needed? - // val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos ? + // TODO: copy of vdef as getter needed? + // val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos? // right now vdef maps via expandedTree to a thicket which concerns itself. // I don't see a problem with that but if there is one we can avoid it by making a copy here. val setterParam = makeSyntheticParameter(tpt = (new SetterParamTree).watching(vdef)) + // The rhs gets filled in later, when field is generated and getter has parameters (see Memoize miniphase) val setterRhs = if (vdef.rhs.isEmpty) EmptyTree else unitLiteral val setter = cpy.DefDef(vdef)( - name = name.setterName, - tparams = Nil, + name = name.setterName, + tparams = Nil, vparamss = (setterParam :: Nil) :: Nil, - tpt = TypeTree(defn.UnitType), - rhs = setterRhs - ).withMods((mods | Accessor) &~ CaseAccessor) // rhs gets filled in later, when field is generated and getter has parameters + tpt = TypeTree(defn.UnitType), + rhs = setterRhs + ).withMods((mods | Accessor) &~ CaseAccessor) Thicket(vdef, setter) } else vdef diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala index a6bb93e4ecf4..f0c4547af06d 100644 --- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala +++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala @@ -50,7 +50,7 @@ import Decorators._ if !ddef.symbol.is(Deferred) && !ddef.symbol.isConstructor && // constructors bodies are added later at phase Constructors ddef.rhs == EmptyTree => - errorLackImplementation(ddef) + errorLackImplementation(ddef) case tdef: TypeDef if tdef.symbol.isClass && !tdef.symbol.is(Deferred) && tdef.rhs == EmptyTree => errorLackImplementation(tdef) @@ -76,12 +76,12 @@ import Decorators._ ctx.newSymbol( owner = ctx.owner, - name = sym.name.asTermName.fieldName, + name = sym.name.asTermName.fieldName, flags = Private | (if (sym is Stable) EmptyFlags else Mutable), - info = fieldType, - coord = tree.pos) - .withAnnotationsCarrying(sym, defn.FieldMetaAnnot) - .enteredAfter(thisTransform) + info = fieldType, + coord = tree.pos + ).withAnnotationsCarrying(sym, defn.FieldMetaAnnot) + .enteredAfter(thisTransform) } /** Can be used to filter annotations on getters and setters; not used yet */ @@ -93,7 +93,7 @@ import Decorators._ lazy val field = sym.field.orElse(newField).asTerm - def adaptToField(tree: Tree) = + def adaptToField(tree: Tree): Tree = if (tree.isEmpty) tree else tree.ensureConforms(field.info.widen) val NoFieldNeeded = Lazy | Deferred | JavaDefined | (if (ctx.settings.YnoInline.value) EmptyFlags else Inline) @@ -127,8 +127,8 @@ import Decorators._ val getterDef = cpy.DefDef(tree)(rhs = getterRhs) Thicket(fieldDef, getterDef) } else if (sym.isSetter) { - if (!sym.is(ParamAccessor)) { val Literal(Constant(())) = tree.rhs } // this is intended as an assertion - field.setFlag(Mutable) // necessary for vals mixed in from Scala2 traits + if (!sym.is(ParamAccessor)) { val Literal(Constant(())) = tree.rhs } // This is intended as an assertion + field.setFlag(Mutable) // Necessary for vals mixed in from Scala2 traits if (isErasableBottomField(tree.vparamss.head.head.tpt.tpe.classSymbol)) tree else { val initializer = Assign(ref(field), adaptToField(ref(tree.vparamss.head.head.symbol))) From 4b6e15ccb274abb69b027be5b3f8c73a4d671ef1 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 28 Jun 2017 19:08:30 +0200 Subject: [PATCH 03/11] Move getter/setter annotation to the underlying field This is nessary for interactiong with java libraries such as JMH. Matches scalac's behavior. --- .../tools/dotc/core/SymDenotations.scala | 2 +- .../dotty/tools/dotc/transform/Memoize.scala | 28 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 7c0529ca0089..2b3563cd9b27 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -277,7 +277,7 @@ object SymDenotations { } /** Update the annotations of this denotation */ - private[core] final def annotations_=(annots: List[Annotation]): Unit = + final def annotations_=(annots: List[Annotation]): Unit = myAnnotations = annots /** Does this denotation have an annotation matching the given class symbol? */ diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala index f0c4547af06d..d9769a1886dc 100644 --- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala +++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala @@ -6,6 +6,7 @@ import DenotTransformers._ import Phases.Phase import Contexts.Context import SymDenotations.SymDenotation +import Denotations._ import Types._ import Symbols._ import SymUtils._ @@ -84,12 +85,21 @@ import Decorators._ .enteredAfter(thisTransform) } - /** Can be used to filter annotations on getters and setters; not used yet */ - def keepAnnotations(denot: SymDenotation, meta: ClassSymbol) = { - val cpy = sym.copySymDenotation() - cpy.filterAnnotations(_.symbol.derivesFrom(meta)) - if (cpy.annotations ne denot.annotations) cpy.installAfter(thisTransform) - } + def addAnnotations(denot: Denotation): Unit = + denot match { + case fieldDenot: SymDenotation if sym.annotations.nonEmpty => + val cpy = fieldDenot.copySymDenotation() + cpy.annotations = sym.annotations + cpy.installAfter(thisTransform) + case _ => () + } + + def removeAnnotations(denot: SymDenotation): Unit = + if (sym.annotations.nonEmpty) { + val cpy = sym.copySymDenotation() + cpy.annotations = Nil + cpy.installAfter(thisTransform) + } lazy val field = sym.field.orElse(newField).asTerm @@ -125,6 +135,8 @@ import Decorators._ if (isErasableBottomField(rhsClass)) erasedBottomTree(rhsClass) else transformFollowingDeep(ref(field))(ctx.withOwner(sym), info) val getterDef = cpy.DefDef(tree)(rhs = getterRhs) + addAnnotations(fieldDef.denot) + removeAnnotations(sym) Thicket(fieldDef, getterDef) } else if (sym.isSetter) { if (!sym.is(ParamAccessor)) { val Literal(Constant(())) = tree.rhs } // This is intended as an assertion @@ -132,7 +144,9 @@ import Decorators._ if (isErasableBottomField(tree.vparamss.head.head.tpt.tpe.classSymbol)) tree else { val initializer = Assign(ref(field), adaptToField(ref(tree.vparamss.head.head.symbol))) - cpy.DefDef(tree)(rhs = transformFollowingDeep(initializer)(ctx.withOwner(sym), info)) + val setterDef = cpy.DefDef(tree)(rhs = transformFollowingDeep(initializer)(ctx.withOwner(sym), info)) + removeAnnotations(sym) + setterDef } } else tree // curiously, some accessors from Scala2 have ' ' suffixes. They count as From 579dd1dc566b64c20b7d7f51f76303004f2892ab Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 15:36:59 +0200 Subject: [PATCH 04/11] Don't lift arguments out of Java annotation constructors Lifting such arguments breaks the contract with the backend, which expects to see default getters inline, not lifted out. --- compiler/src/dotty/tools/dotc/typer/Applications.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 5fc2885e2f27..efa70d60f8ab 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -575,8 +575,11 @@ trait Applications extends Compatibility { self: Typer with Dynamic => def normalizedFun = myNormalizedFun + private def isJavaAnnotConstr(sym: Symbol) = + sym.is(JavaDefined) && sym.isConstructor && sym.owner.derivesFrom(defn.AnnotationClass) + override def liftFun(): Unit = - if (liftedDefs == null) { + if (liftedDefs == null && !isJavaAnnotConstr(methRef.symbol)) { liftedDefs = new mutable.ListBuffer[Tree] myNormalizedFun = liftApp(liftedDefs, myNormalizedFun) } From a1b6c3e9a94b3b89d78022c6082668d3e1db82f4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 15:37:23 +0200 Subject: [PATCH 05/11] Workaround #2797 by removing an assertion (reverted from commit e83aca6947e5dd5bf2c2779b4e9230f6be6565ea) --- .../src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 7ce9e3707e05..297f7e0f8934 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -256,7 +256,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val evalue = t.symbol.name.mangledString // value the actual enumeration value. av.visitEnum(name, edesc, evalue) } else { - // This is a default getter. do not emmit. + assert(toDenot(t.symbol).name.is(DefaultGetterName), toDenot(t.symbol).name.debugString) // this should be default getter. do not emmit. } case t: SeqLiteral => val arrAnnotV: AnnotationVisitor = av.visitArray(name) From 546c59f09d18afa46baff1761f9a3c477b34100f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 15:51:00 +0200 Subject: [PATCH 06/11] Fix handling of defaults in Java annotations - Java-defined annotation constructors need to have JavaDefined set. - Change the points where we suppress lifting. One case slipped through before. - Also: Add test. --- .../tools/dotc/core/classfile/ClassfileParser.scala | 2 +- .../src/dotty/tools/dotc/typer/Applications.scala | 13 +++++++------ tests/pos/i2797/Fork.java | 4 ++++ tests/pos/i2797/Test.scala | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 tests/pos/i2797/Fork.java create mode 100644 tests/pos/i2797/Test.scala diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index b706ea78214a..dd5240acf0c3 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -637,7 +637,7 @@ class ClassfileParser( val constr = ctx.newSymbol( owner = classRoot.symbol, name = nme.CONSTRUCTOR, - flags = Flags.Synthetic, + flags = Flags.Synthetic | Flags.JavaDefined, info = constrType ).entered for ((attr, i) <- attrs.zipWithIndex) diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index efa70d60f8ab..47bc8bc868dd 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -395,6 +395,10 @@ trait Applications extends Compatibility { self: Typer with Dynamic => } } + /** Is `sym` a constructor of a Java-defined annotation? */ + def isJavaAnnotConstr(sym: Symbol) = + sym.is(JavaDefined) && sym.isConstructor && sym.owner.derivesFrom(defn.AnnotationClass) + /** Match re-ordered arguments against formal parameters * @param n The position of the first parameter in formals in `methType`. */ @@ -420,7 +424,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => } def tryDefault(n: Int, args1: List[Arg]): Unit = { - liftFun() + if (!isJavaAnnotConstr(methRef.symbol)) liftFun() val getter = findDefaultGetter(n + numArgs(normalizedFun)) if (getter.isEmpty) missingArg(n) else { @@ -575,11 +579,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic => def normalizedFun = myNormalizedFun - private def isJavaAnnotConstr(sym: Symbol) = - sym.is(JavaDefined) && sym.isConstructor && sym.owner.derivesFrom(defn.AnnotationClass) - override def liftFun(): Unit = - if (liftedDefs == null && !isJavaAnnotConstr(methRef.symbol)) { + if (liftedDefs == null) { liftedDefs = new mutable.ListBuffer[Tree] myNormalizedFun = liftApp(liftedDefs, myNormalizedFun) } @@ -610,7 +611,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => val app1 = if (!success) app0.withType(UnspecifiedErrorType) else { - if (!sameSeq(args, orderedArgs)) { + if (!sameSeq(args, orderedArgs) && !isJavaAnnotConstr(methRef.symbol)) { // need to lift arguments to maintain evaluation order in the // presence of argument reorderings. liftFun() diff --git a/tests/pos/i2797/Fork.java b/tests/pos/i2797/Fork.java new file mode 100644 index 000000000000..af6d5fc3b445 --- /dev/null +++ b/tests/pos/i2797/Fork.java @@ -0,0 +1,4 @@ +public @interface Fork { + int value() default -1; + String[] jvmArgs() default { "nope" }; +} diff --git a/tests/pos/i2797/Test.scala b/tests/pos/i2797/Test.scala new file mode 100644 index 000000000000..6d7f32cb9075 --- /dev/null +++ b/tests/pos/i2797/Test.scala @@ -0,0 +1,2 @@ +@Fork(jvmArgs = Array("I'm", "hot")) +class Test From a02b10b862a9b9b23866afae4741d451ed64bb9b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 16:19:21 +0200 Subject: [PATCH 07/11] Move test to pending Test is pending because we have no good way to test it. We need to: Compile Fork.java, and then compile Test.scala with Fork.class on the classpath. --- tests/pending/pos/i2797/Fork_1.java | 7 +++++++ tests/pending/pos/i2797/Test_2.scala | 5 +++++ tests/pos/i2797/Fork.java | 4 ---- tests/pos/i2797/Test.scala | 2 -- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 tests/pending/pos/i2797/Fork_1.java create mode 100644 tests/pending/pos/i2797/Test_2.scala delete mode 100644 tests/pos/i2797/Fork.java delete mode 100644 tests/pos/i2797/Test.scala diff --git a/tests/pending/pos/i2797/Fork_1.java b/tests/pending/pos/i2797/Fork_1.java new file mode 100644 index 000000000000..efb9748d5158 --- /dev/null +++ b/tests/pending/pos/i2797/Fork_1.java @@ -0,0 +1,7 @@ +// Test is pending because we have no good way to test it. +// We need to: Compile Fork.java, and then compile Test.scala +// with Fork.class on the classpath. +public @interface Fork { + int value() default -1; + String[] jvmArgs() default { "nope" }; +} diff --git a/tests/pending/pos/i2797/Test_2.scala b/tests/pending/pos/i2797/Test_2.scala new file mode 100644 index 000000000000..4f45735e1cab --- /dev/null +++ b/tests/pending/pos/i2797/Test_2.scala @@ -0,0 +1,5 @@ +// Test is pending because we have no good way to test it. +// We need to: Compile Fork.java, and then compile Test.scala +// with Fork.class on the classpath. +@Fork(jvmArgs = Array("I'm", "hot")) +class Test diff --git a/tests/pos/i2797/Fork.java b/tests/pos/i2797/Fork.java deleted file mode 100644 index af6d5fc3b445..000000000000 --- a/tests/pos/i2797/Fork.java +++ /dev/null @@ -1,4 +0,0 @@ -public @interface Fork { - int value() default -1; - String[] jvmArgs() default { "nope" }; -} diff --git a/tests/pos/i2797/Test.scala b/tests/pos/i2797/Test.scala deleted file mode 100644 index 6d7f32cb9075..000000000000 --- a/tests/pos/i2797/Test.scala +++ /dev/null @@ -1,2 +0,0 @@ -@Fork(jvmArgs = Array("I'm", "hot")) -class Test From c15ff7b29051bd7ee1d624a6903dbb53b0ceaa75 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 16:38:17 +0200 Subject: [PATCH 08/11] Add Scala test case --- tests/pos/i2797a/Fork.scala | 5 +++++ tests/pos/i2797a/Test.scala | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/pos/i2797a/Fork.scala create mode 100644 tests/pos/i2797a/Test.scala diff --git a/tests/pos/i2797a/Fork.scala b/tests/pos/i2797a/Fork.scala new file mode 100644 index 000000000000..70554852ac00 --- /dev/null +++ b/tests/pos/i2797a/Fork.scala @@ -0,0 +1,5 @@ +// Test is pending because we have no good way to test it. +// We need to: Compile Fork.java, and then compile Test.scala +// with Fork.class on the classpath. +class Fork(value: Int = -1, jvmArgs: Array[String] = Array("nope")) +extends annotation.Annotation diff --git a/tests/pos/i2797a/Test.scala b/tests/pos/i2797a/Test.scala new file mode 100644 index 000000000000..4f45735e1cab --- /dev/null +++ b/tests/pos/i2797a/Test.scala @@ -0,0 +1,5 @@ +// Test is pending because we have no good way to test it. +// We need to: Compile Fork.java, and then compile Test.scala +// with Fork.class on the classpath. +@Fork(jvmArgs = Array("I'm", "hot")) +class Test From 7a35bf85d2b583e86925342c2d9b20996b3684ce Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Jul 2017 19:26:57 +0200 Subject: [PATCH 09/11] Fix typo in docs --- docs/docs/reference/dropped/weak-conformance.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/reference/dropped/weak-conformance.md b/docs/docs/reference/dropped/weak-conformance.md index 8b592c1af76b..0c796f9e2cd9 100644 --- a/docs/docs/reference/dropped/weak-conformance.md +++ b/docs/docs/reference/dropped/weak-conformance.md @@ -6,7 +6,7 @@ title: Dropped: Weak Conformance In some situations, Scala used a _weak conformance_ relation when testing type compatibility or computing the least upper bound of a set of types. The principal motivation behind weak conformance was to -make as expression like this have type `List[Double]`: +make an expression like this have type `List[Double]`: List(1.0, math.sqrt(3.0), 0, -3.3) // : List[Double] @@ -37,6 +37,7 @@ assigning a type to a constant expression. The new rule is: - the alternatives of an if-then-else or match expression, or - the body and catch results of a try expression, + and all expressions have primitive numeric types, but they do not all have the same type, then the following is attempted: Every constant expression `E` in `Es` is widened to the least primitive From a707a74943c3ea886c50bd1ade1c3db2b96c2118 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Mon, 10 Jul 2017 19:38:30 +0200 Subject: [PATCH 10/11] Fix test i2797 Fork_1.java failed to compile before because the class name did not match the filename. --- tests/{pending => }/pos/i2797/Fork_1.java | 2 +- tests/{pending => }/pos/i2797/Test_2.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/{pending => }/pos/i2797/Fork_1.java (89%) rename tests/{pending => }/pos/i2797/Test_2.scala (81%) diff --git a/tests/pending/pos/i2797/Fork_1.java b/tests/pos/i2797/Fork_1.java similarity index 89% rename from tests/pending/pos/i2797/Fork_1.java rename to tests/pos/i2797/Fork_1.java index efb9748d5158..d58d439d679e 100644 --- a/tests/pending/pos/i2797/Fork_1.java +++ b/tests/pos/i2797/Fork_1.java @@ -1,7 +1,7 @@ // Test is pending because we have no good way to test it. // We need to: Compile Fork.java, and then compile Test.scala // with Fork.class on the classpath. -public @interface Fork { +public @interface Fork_1 { int value() default -1; String[] jvmArgs() default { "nope" }; } diff --git a/tests/pending/pos/i2797/Test_2.scala b/tests/pos/i2797/Test_2.scala similarity index 81% rename from tests/pending/pos/i2797/Test_2.scala rename to tests/pos/i2797/Test_2.scala index 4f45735e1cab..686bbfb31ace 100644 --- a/tests/pending/pos/i2797/Test_2.scala +++ b/tests/pos/i2797/Test_2.scala @@ -1,5 +1,5 @@ // Test is pending because we have no good way to test it. // We need to: Compile Fork.java, and then compile Test.scala // with Fork.class on the classpath. -@Fork(jvmArgs = Array("I'm", "hot")) +@Fork_1(jvmArgs = Array("I'm", "hot")) class Test From bc2b6c3c7216af9385cac34aea3d8cd5af8dadf0 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Mon, 10 Jul 2017 20:32:52 +0200 Subject: [PATCH 11/11] Disable i2797 again While the test now succeeds under separate compilation, it fails join compilation (which happens to be tested by the legacy tests currently), you can reproduce that by running: dotc tests/pending/pos/i2797/Fork_1.java tests/pending/pos/i2797/Test_2.scala This fails with: -- Error: tests/pending/pos/i2797/Test_2.scala:4:0 ------------------------------------- 4 |@Fork_1(jvmArgs = Array("I'm", "hot")) |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |missing argument for parameter value of constructor Fork_1: (value: |Int, jvmArgs: Array[String]): Fork_1 Because the JavaParsers output a constructor for Fork_1 without default values, to fix this we need JavaParsers to do something similar to ClassfileParser#addAnnotationConstructor --- tests/{ => pending}/pos/i2797/Fork_1.java | 0 tests/{ => pending}/pos/i2797/Test_2.scala | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/{ => pending}/pos/i2797/Fork_1.java (100%) rename tests/{ => pending}/pos/i2797/Test_2.scala (100%) diff --git a/tests/pos/i2797/Fork_1.java b/tests/pending/pos/i2797/Fork_1.java similarity index 100% rename from tests/pos/i2797/Fork_1.java rename to tests/pending/pos/i2797/Fork_1.java diff --git a/tests/pos/i2797/Test_2.scala b/tests/pending/pos/i2797/Test_2.scala similarity index 100% rename from tests/pos/i2797/Test_2.scala rename to tests/pending/pos/i2797/Test_2.scala