From 53cd512eef8f9f28527e7c72d108359f0313d3f5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 14:33:35 +0100 Subject: [PATCH 01/11] Disable context escape detection I get very frequent build failures due to the mutual Scala<->Java dependency. It builds for a long time, then decides that getCtx overrides nothing. The only way to fix is another clean build. Total time lost: >5 minutes. These happened occasionally before but have become much more frequent under ScalaIDe4.0, to the point where this becomes a major drag on productity. Context escape detection is nice but if it stops us getting work done, not worth the effort. --- test/test/DottyTest.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test/DottyTest.scala b/test/test/DottyTest.scala index 90a0154ec1cd..21eebd660c59 100644 --- a/test/test/DottyTest.scala +++ b/test/test/DottyTest.scala @@ -14,7 +14,7 @@ import dotty.tools.dotc.Compiler import dotty.tools.dotc import dotty.tools.dotc.core.Phases.Phase -class DottyTest extends ContextEscapeDetection{ +class DottyTest /*extends ContextEscapeDetection*/ { dotty.tools.dotc.parsing.Scanners // initialize keywords @@ -36,11 +36,12 @@ class DottyTest extends ContextEscapeDetection{ base.definitions.init(ctx) ctx } - +/* override def getCtx: Context = ctx override def clearCtx() = { ctx = null } +*/ private def compilerWithChecker(phase: String)(assertion:(tpd.Tree, Context) => Unit) = new Compiler { self => override def phases = { From 73d008317a6afaa0fea103ec0c84a39386f7d776 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 15:19:52 +0100 Subject: [PATCH 02/11] Fix NoCyclicReference test The problem was that, unlike a classDefSig, a higher-kinded typeDefSig did not get a preset info with its type parameters. So any type-application of the defined type in its bounds would fail. --- src/dotty/tools/dotc/typer/Namer.scala | 22 +++++++++---------- .../{pending => }/pos/NoCyclicReference.scala | 0 2 files changed, 11 insertions(+), 11 deletions(-) rename tests/{pending => }/pos/NoCyclicReference.scala (100%) diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 86376356c742..323a1100ba1f 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -673,7 +673,15 @@ class Namer { typer: Typer => def typeDefSig(tdef: TypeDef, sym: Symbol)(implicit ctx: Context): Type = { completeParams(tdef.tparams) - sym.info = TypeBounds.empty + val tparamSyms = tdef.tparams map symbolOfTree + val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree] + val toParameterize = tparamSyms.nonEmpty && !isDerived + val needsLambda = sym.allOverriddenSymbols.exists(_ is HigherKinded) && !isDerived + def abstracted(tp: Type): Type = + if (needsLambda) tp.LambdaAbstract(tparamSyms) + else if (toParameterize) tp.parameterizeWith(tparamSyms) + else tp + sym.info = abstracted(TypeBounds.empty) // Temporarily set info of defined type T to ` >: Nothing <: Any. // This is done to avoid cyclic reference errors for F-bounds. // This is subtle: `sym` has now an empty TypeBounds, but is not automatically @@ -684,18 +692,10 @@ class Namer { typer: Typer => // // The scheme critically relies on an implementation detail of isRef, which // inspects a TypeRef's info, instead of simply dealiasing alias types. - val tparamSyms = tdef.tparams map symbolOfTree - val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree] - val toParameterize = tparamSyms.nonEmpty && !isDerived - val needsLambda = sym.allOverriddenSymbols.exists(_ is HigherKinded) && !isDerived val rhsType = typedAheadType(tdef.rhs).tpe - def abstractedRhsType = - if (needsLambda) rhsType.LambdaAbstract(tparamSyms) - else if (toParameterize) rhsType.parameterizeWith(tparamSyms) - else rhsType val unsafeInfo = rhsType match { - case _: TypeBounds => abstractedRhsType.asInstanceOf[TypeBounds] - case _ => TypeAlias(abstractedRhsType, if (sym is Local) sym.variance else 0) + case _: TypeBounds => abstracted(rhsType).asInstanceOf[TypeBounds] + case _ => TypeAlias(abstracted(rhsType), if (sym is Local) sym.variance else 0) } sym.info = NoCompleter checkNonCyclic(sym, unsafeInfo, reportErrors = true) diff --git a/tests/pending/pos/NoCyclicReference.scala b/tests/pos/NoCyclicReference.scala similarity index 100% rename from tests/pending/pos/NoCyclicReference.scala rename to tests/pos/NoCyclicReference.scala From 63c582b39ba8a248c9d6ad23db2224ea4a809a58 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 15:21:34 +0100 Subject: [PATCH 03/11] Test re-org. Moved some working test to pos. I wonder why they were in pending? They did work for me. --- .../not-representable}/CustomGlobal.scala | 0 .../not-representable}/MailBox.scala | 0 tests/new/t296.scala | 5 ----- tests/{pending => }/pos/List1.scala | 0 tests/pos/t296.scala | 4 +++- tests/untried/pos/t2610.scala | 17 ----------------- 6 files changed, 3 insertions(+), 23 deletions(-) rename tests/{pending/pos => disabled/not-representable}/CustomGlobal.scala (100%) rename tests/{pending/pos => disabled/not-representable}/MailBox.scala (100%) delete mode 100644 tests/new/t296.scala rename tests/{pending => }/pos/List1.scala (100%) delete mode 100644 tests/untried/pos/t2610.scala diff --git a/tests/pending/pos/CustomGlobal.scala b/tests/disabled/not-representable/CustomGlobal.scala similarity index 100% rename from tests/pending/pos/CustomGlobal.scala rename to tests/disabled/not-representable/CustomGlobal.scala diff --git a/tests/pending/pos/MailBox.scala b/tests/disabled/not-representable/MailBox.scala similarity index 100% rename from tests/pending/pos/MailBox.scala rename to tests/disabled/not-representable/MailBox.scala diff --git a/tests/new/t296.scala b/tests/new/t296.scala deleted file mode 100644 index bb3b22984ae3..000000000000 --- a/tests/new/t296.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Bug { - def foo (l: => String, l1: => String) : String = 12 match { - case 12 => l1 - case _ => l} -} diff --git a/tests/pending/pos/List1.scala b/tests/pos/List1.scala similarity index 100% rename from tests/pending/pos/List1.scala rename to tests/pos/List1.scala diff --git a/tests/pos/t296.scala b/tests/pos/t296.scala index 0c267a307e93..bb3b22984ae3 100644 --- a/tests/pos/t296.scala +++ b/tests/pos/t296.scala @@ -1,3 +1,5 @@ object Bug { - def foo (l: => String) : String = 12 match { case _ => l} + def foo (l: => String, l1: => String) : String = 12 match { + case 12 => l1 + case _ => l} } diff --git a/tests/untried/pos/t2610.scala b/tests/untried/pos/t2610.scala deleted file mode 100644 index 8a82b4a72f87..000000000000 --- a/tests/untried/pos/t2610.scala +++ /dev/null @@ -1,17 +0,0 @@ -package mada; package defects; package tests - -package object bbb { - def bar = () - aaa.foo // value foo is not a member of package mada.defects.tests.aaa -} - -package object aaa { - def foo = () -} - -/* compiles successfully if placed here.. -package object bbb { - def bar = () - aaa.foo // value foo is not a member of package mada.defects.tests.aaa -} -*/ From 848714377b68eedf0c66b59ff8c57cd0da10109c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 16:41:57 +0100 Subject: [PATCH 04/11] Eliminate unused method from RefChecks. --- src/dotty/tools/dotc/typer/RefChecks.scala | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala index e2855c8f6468..0ccb589ac49b 100644 --- a/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/src/dotty/tools/dotc/typer/RefChecks.scala @@ -184,12 +184,6 @@ object RefChecks { emitOverrideError(overrideErrorMsg(msg)) } - def overrideTypeError() = { - if (noErrorType) { - emitOverrideError(overrideErrorMsg("has incompatible type")) - } - } - def overrideAccessError() = { ctx.log(i"member: ${member.showLocated} ${member.flags}") // DEBUG ctx.log(i"other: ${other.showLocated} ${other.flags}") // DEBUG From cf6b62f11815fc98fe69e25875668c8709631656 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 16:43:05 +0100 Subject: [PATCH 05/11] Avoid name clashes when generating synthetic companion objects. --- src/dotty/tools/dotc/core/NameOps.scala | 15 ++++++++++++--- src/dotty/tools/dotc/core/StdNames.scala | 1 + src/dotty/tools/dotc/core/SymDenotations.scala | 9 +++++++-- .../tools/dotc/transform/FirstTransform.scala | 10 +++++++++- tests/{pending/pos => new}/S5.scala | 3 ++- 5 files changed, 31 insertions(+), 7 deletions(-) rename tests/{pending/pos => new}/S5.scala (88%) diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index a6b40fe66b2e..240447e6d43c 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -72,6 +72,7 @@ object NameOps { def isSetterName = name endsWith SETTER_SUFFIX def isSingletonName = name endsWith SINGLETON_SUFFIX def isModuleClassName = name endsWith MODULE_SUFFIX + def isAvoidClashName = name endsWith AVOID_CLASH_SUFFIX def isImportName = name startsWith IMPORT def isFieldName = name endsWith LOCAL_SUFFIX def isInheritedName = name.length > 0 && name.head == '(' && name.startsWith(nme.INHERITED) @@ -129,11 +130,19 @@ object NameOps { /** If name ends in module class suffix, drop it */ def stripModuleClassSuffix: Name = if (isModuleClassName) name dropRight MODULE_SUFFIX.length else name + + /** Append a suffix so that this name does not clash with another name in the same scope */ + def avoidClashName: TermName = (name ++ AVOID_CLASH_SUFFIX).toTermName + + /** If name ends in "avoid clash" suffix, drop it */ + def stripAvoidClashSuffix: Name = + if (isAvoidClashName) name dropRight AVOID_CLASH_SUFFIX.length else name /** If flags is a ModuleClass but not a Package, add module class suffix */ - def adjustIfModuleClass(flags: Flags.FlagSet): N = - if (flags is (ModuleClass, butNot = Package)) name.asTypeName.moduleClassName.asInstanceOf[N] - else name + def adjustIfModuleClass(flags: Flags.FlagSet): N = { + if (flags is (ModuleClass, butNot = Package)) name.asTypeName.moduleClassName + else stripAvoidClashSuffix + }.asInstanceOf[N] /** The superaccessor for method with given name */ def superName: TermName = (nme.SUPER_PREFIX ++ name).toTermName diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala index 04bcf616dd74..27aa00392808 100644 --- a/src/dotty/tools/dotc/core/StdNames.scala +++ b/src/dotty/tools/dotc/core/StdNames.scala @@ -107,6 +107,7 @@ object StdNames { val INTERPRETER_WRAPPER_SUFFIX: N = "$object" val LOCALDUMMY_PREFIX: N = " - Thicket(stat :: newCompanion(stat.name.toTermName).trees) + val objName = stat.name.toTermName + val nameClash = stats.exists { + case other: MemberDef => + other.name == objName && other.symbol.info.isParameterless + case _ => + false + } + val uniqueName = if (nameClash) objName.avoidClashName else objName + Thicket(stat :: newCompanion(uniqueName).trees) case stat => stat } diff --git a/tests/pending/pos/S5.scala b/tests/new/S5.scala similarity index 88% rename from tests/pending/pos/S5.scala rename to tests/new/S5.scala index f0b66a6e68fe..ba87869a14bf 100644 --- a/tests/pending/pos/S5.scala +++ b/tests/new/S5.scala @@ -1,4 +1,5 @@ -/* Here's a fragment of a Scala encoding for the Keris module system; +/* Original comment: + * Here's a fragment of a Scala encoding for the Keris module system; ** the compiler claims: ** ** S5.scala:28: value n in class N of type N.this._N.n From d21310b8baa847f1b0cd14986f8ec1084b59e6fe Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 18:56:03 +0100 Subject: [PATCH 06/11] Fix isUnboundedGeneric for alias types. Fixes problem in test case SI-7638a.scala which gave an override error before. --- src/dotty/tools/dotc/TypeErasure.scala | 6 +-- tests/pos/SI-7638a.scala | 52 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 tests/pos/SI-7638a.scala diff --git a/src/dotty/tools/dotc/TypeErasure.scala b/src/dotty/tools/dotc/TypeErasure.scala index a9ae34213df2..3ddd105957fb 100644 --- a/src/dotty/tools/dotc/TypeErasure.scala +++ b/src/dotty/tools/dotc/TypeErasure.scala @@ -160,11 +160,11 @@ object TypeErasure { * as upper bound and that is not Java defined? Arrays of such types are * erased to `Object` instead of `ObjectArray`. */ - def isUnboundedGeneric(tp: Type)(implicit ctx: Context): Boolean = tp match { + def isUnboundedGeneric(tp: Type)(implicit ctx: Context): Boolean = tp.dealias match { case tp: TypeRef => - tp.symbol.isAbstractType && + !tp.symbol.isClass && !tp.derivesFrom(defn.ObjectClass) && - !tp.typeSymbol.is(JavaDefined) + !tp.symbol.is(JavaDefined) case tp: PolyParam => !tp.derivesFrom(defn.ObjectClass) && !tp.binder.resultType.isInstanceOf[JavaMethodType] diff --git a/tests/pos/SI-7638a.scala b/tests/pos/SI-7638a.scala new file mode 100644 index 000000000000..060bd0ffa978 --- /dev/null +++ b/tests/pos/SI-7638a.scala @@ -0,0 +1,52 @@ +// Same as SI-7638, but without (Int) arguments to @specialized +package miniboxing.tests.compile + +trait Ordering[@specialized A] { + def eqv(x: Array[A], y: Array[A]): Boolean = false +} + +trait ArrayVectorOrder[@specialized A] extends Ordering[A] { + override def eqv(x: Array[A], y: Array[A]): Boolean = super.eqv(x, y) +} + +object vectorOrder { + implicit def arrayOrder[@specialized A](): miniboxing.tests.compile.ArrayVectorOrder[A] = + /* + * Before applying patch: + * + * while compiling: SI-7638.scala + * during phase: mixin + * library version: version 2.10.3-20130625-164027-d22e8d282c + * compiler version: version 2.10.3-20130627-153946-54cb6af7db + * reconstructed args: + * + * last tree to typer: TypeTree(class Array) + * symbol: class Array in package scala (flags: final) + * symbol definition: final class Array[T >: ? <: ?] extends Object + * tpe: Array[Int] + * symbol owners: class Array -> package scala + * context owners: anonymous class anon$1 -> package compile + * + * == Expanded type of tree == + * + * TypeRef( + * TypeSymbol(final class Array[T >: ? <: ?] extends Object) + * args = List(TypeRef(TypeSymbol(final abstract class Int extends ))) + * ) + * + * unhandled exception while transforming SI-7638.scala + * error: uncaught exception during compilation: java.lang.UnsupportedOperationException + * error: java.lang.UnsupportedOperationException: tail of empty list + * at scala.collection.immutable.Nil$.tail(List.scala:339) + * at scala.collection.immutable.Nil$.tail(List.scala:334) + * at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:123) + * at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$rebindSuper$1.apply(Mixin.scala:122) + * at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:207) + * at scala.reflect.internal.SymbolTable.afterPhase(SymbolTable.scala:216) + * at scala.tools.nsc.Global.afterPickler(Global.scala:1104) + * at scala.tools.nsc.transform.Mixin.scala$tools$nsc$transform$Mixin$$rebindSuper(Mixin.scala:122) + * at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:339) + * at scala.tools.nsc.transform.Mixin$$anonfun$scala$tools$nsc$transform$Mixin$$mixinTraitMembers$1$1.apply(Mixin.scala:292) + */ + new ArrayVectorOrder[A] { } +} From 431b2b73e6558faa6e34bd527c8ed3b9fd6d638f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 18:59:44 +0100 Subject: [PATCH 07/11] Removed dead code. isUnboundedGeneric imples !JavaDefined anyway. --- src/dotty/tools/dotc/TypeErasure.scala | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/dotty/tools/dotc/TypeErasure.scala b/src/dotty/tools/dotc/TypeErasure.scala index 3ddd105957fb..a45e29287f3d 100644 --- a/src/dotty/tools/dotc/TypeErasure.scala +++ b/src/dotty/tools/dotc/TypeErasure.scala @@ -342,11 +342,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild private def eraseArray(tp: RefinedType)(implicit ctx: Context) = { val defn.ArrayType(elemtp) = tp if (elemtp derivesFrom defn.NullClass) JavaArrayType(defn.ObjectType) - else if (isUnboundedGeneric(elemtp)) - elemtp match { - case elemtp: TypeRef if elemtp.symbol.is(JavaDefined) => JavaArrayType(defn.ObjectType) - case _ => defn.ObjectType - } + else if (isUnboundedGeneric(elemtp)) defn.ObjectType else JavaArrayType(this(elemtp)) } From ed1016201ee3f1784243c6d04d84164369c56254 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 19:00:25 +0100 Subject: [PATCH 08/11] Harden implicit scope computation against CyclicReference errors. --- src/dotty/tools/dotc/core/Contexts.scala | 6 ++++- src/dotty/tools/dotc/core/Types.scala | 2 +- tests/new/S5.scala | 31 ------------------------ tests/{pending => }/pos/SI-7638.scala | 0 4 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 tests/new/S5.scala rename tests/{pending => }/pos/SI-7638.scala (100%) diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 635390ef5ae3..b11e77ef2e19 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -170,7 +170,11 @@ object Contexts { if (implicitsCache == null ) implicitsCache = { val implicitRefs: List[TermRef] = - if (isClassDefContext) owner.thisType.implicitMembers + if (isClassDefContext) + try owner.thisType.implicitMembers + catch { + case ex: CyclicReference => Nil + } else if (isImportContext) importInfo.importedImplicits else if (isNonEmptyScopeContext) scope.implicitDecls else Nil diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 141b29ab792e..b8e0a48c129c 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2976,7 +2976,7 @@ object Types { val ex = new CyclicReference(denot) if (!(ctx.mode is typer.Mode.CheckCyclic)) { cyclicErrors.println(ex.getMessage) - for (elem <- ex.getStackTrace take 40) + for (elem <- ex.getStackTrace take 50) cyclicErrors.println(elem.toString) } ex diff --git a/tests/new/S5.scala b/tests/new/S5.scala deleted file mode 100644 index ba87869a14bf..000000000000 --- a/tests/new/S5.scala +++ /dev/null @@ -1,31 +0,0 @@ -/* Original comment: - * Here's a fragment of a Scala encoding for the Keris module system; -** the compiler claims: -** -** S5.scala:28: value n in class N of type N.this._N.n -** cannot override value n in class M of type M.this._N.n -** val system = new M() with N() {} -** ^ -** To me it seems like the code is perfectly fine... -*/ -abstract class M() { - val _N: N; - val n: _N.n; - val _M: M = this; - val m: _M.m = new _M.m(); - class m() { - // module body of M - } -} -trait N { - val _N: N = this; - val n: _N.n = new _N.n(); - val _M: M; - val m: _M.m; - class n() { - // module body of N - } -} -object O { - val system = new M() with N {} -} diff --git a/tests/pending/pos/SI-7638.scala b/tests/pos/SI-7638.scala similarity index 100% rename from tests/pending/pos/SI-7638.scala rename to tests/pos/SI-7638.scala From eb4bb1d092014be19b1669a7c16c6df3e11fda28 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Dec 2014 19:01:29 +0100 Subject: [PATCH 09/11] New passing tests. --- tests/pos/S5.scala | 31 +++++++++++++++++++++++++++ tests/{pending => }/pos/SI-5788.scala | 0 2 files changed, 31 insertions(+) create mode 100644 tests/pos/S5.scala rename tests/{pending => }/pos/SI-5788.scala (100%) diff --git a/tests/pos/S5.scala b/tests/pos/S5.scala new file mode 100644 index 000000000000..ba87869a14bf --- /dev/null +++ b/tests/pos/S5.scala @@ -0,0 +1,31 @@ +/* Original comment: + * Here's a fragment of a Scala encoding for the Keris module system; +** the compiler claims: +** +** S5.scala:28: value n in class N of type N.this._N.n +** cannot override value n in class M of type M.this._N.n +** val system = new M() with N() {} +** ^ +** To me it seems like the code is perfectly fine... +*/ +abstract class M() { + val _N: N; + val n: _N.n; + val _M: M = this; + val m: _M.m = new _M.m(); + class m() { + // module body of M + } +} +trait N { + val _N: N = this; + val n: _N.n = new _N.n(); + val _M: M; + val m: _M.m; + class n() { + // module body of N + } +} +object O { + val system = new M() with N {} +} diff --git a/tests/pending/pos/SI-5788.scala b/tests/pos/SI-5788.scala similarity index 100% rename from tests/pending/pos/SI-5788.scala rename to tests/pos/SI-5788.scala From 7d513b4f3342c17e8b603a43c40770d0f97424de Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 20 Dec 2014 21:51:06 +0100 Subject: [PATCH 10/11] Don't emit copy method for case classes with repeated parameters. scalac has the same restriction. The reason is that we do not have a means to specify a sequence-valued default for a vararg parameter. It would be nice if we could, but this requires a more substantial development effort. --- src/dotty/tools/dotc/ast/Desugar.scala | 6 +++++- tests/{pending => }/pos/annotDepMethType.scala | 0 2 files changed, 5 insertions(+), 1 deletion(-) rename tests/{pending => }/pos/annotDepMethType.scala (100%) diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 05f652a39bab..32ada504daa0 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -290,8 +290,12 @@ object desugar { val caseParams = constrVparamss.head.toArray val productElemMeths = for (i <- 0 until arity) yield syntheticProperty(nme.selectorName(i), Select(This(EmptyTypeName), caseParams(i).name)) + val hasRepeatedParam = constrVparamss.exists(_.exists { + case ValDef(_, PostfixOp(_, nme.raw.STAR), _) => true + case _ => false + }) val copyMeths = - if (mods is Abstract) Nil + if (mods.is(Abstract) || hasRepeatedParam) Nil // cannot have default arguments for repeated parameters, hence copy method is not issued else { def copyDefault(vparam: ValDef) = makeAnnotated(defn.UncheckedVarianceAnnot, refOfDef(vparam)) diff --git a/tests/pending/pos/annotDepMethType.scala b/tests/pos/annotDepMethType.scala similarity index 100% rename from tests/pending/pos/annotDepMethType.scala rename to tests/pos/annotDepMethType.scala From b6755f6927c07337b0819d7503f2c7b1674d892f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 21 Dec 2014 12:44:03 +0100 Subject: [PATCH 11/11] tests reorgs Move some tests into proper slots + comments what they are. --- .../pos/annotated-original/C_2.scala | 0 .../pos/annotated-original/M_1.scala | 0 .../annotated-treecopy/Impls_Macros_1.scala | 0 .../pos/annotated-treecopy/Test_2.scala | 0 .../rewrite-needed/CustomGlobal.scala | 33 +++++++++++++++++++ tests/pending/pos/annotations.scala | 2 ++ 6 files changed, 35 insertions(+) rename tests/{pending => disabled/not-representable}/pos/annotated-original/C_2.scala (100%) rename tests/{pending => disabled/not-representable}/pos/annotated-original/M_1.scala (100%) rename tests/{pending => disabled/not-representable}/pos/annotated-treecopy/Impls_Macros_1.scala (100%) rename tests/{pending => disabled/not-representable}/pos/annotated-treecopy/Test_2.scala (100%) create mode 100644 tests/disabled/rewrite-needed/CustomGlobal.scala diff --git a/tests/pending/pos/annotated-original/C_2.scala b/tests/disabled/not-representable/pos/annotated-original/C_2.scala similarity index 100% rename from tests/pending/pos/annotated-original/C_2.scala rename to tests/disabled/not-representable/pos/annotated-original/C_2.scala diff --git a/tests/pending/pos/annotated-original/M_1.scala b/tests/disabled/not-representable/pos/annotated-original/M_1.scala similarity index 100% rename from tests/pending/pos/annotated-original/M_1.scala rename to tests/disabled/not-representable/pos/annotated-original/M_1.scala diff --git a/tests/pending/pos/annotated-treecopy/Impls_Macros_1.scala b/tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala similarity index 100% rename from tests/pending/pos/annotated-treecopy/Impls_Macros_1.scala rename to tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala diff --git a/tests/pending/pos/annotated-treecopy/Test_2.scala b/tests/disabled/not-representable/pos/annotated-treecopy/Test_2.scala similarity index 100% rename from tests/pending/pos/annotated-treecopy/Test_2.scala rename to tests/disabled/not-representable/pos/annotated-treecopy/Test_2.scala diff --git a/tests/disabled/rewrite-needed/CustomGlobal.scala b/tests/disabled/rewrite-needed/CustomGlobal.scala new file mode 100644 index 000000000000..a5668bd7c0f0 --- /dev/null +++ b/tests/disabled/rewrite-needed/CustomGlobal.scala @@ -0,0 +1,33 @@ +package custom + +import scala.tools.nsc._, reporters._, typechecker._ + +/** Demonstration of a custom Global with a custom Typer, + * decoupled from trunk. Demonstration: + * +{{{ +scalac -d . CustomGlobal.scala && scala -nc -Yglobal-class custom.CustomGlobal \ + -e 'class Bippy(x: Int) ; def f = new Bippy(5)' + +I'm typing a Bippy! It's a ClassDef. +I'm typing a Bippy! It's a Ident. +I'm typing a Bippy! It's a DefDef. +}}} + * + */ +class CustomGlobal(currentSettings: Settings, reporter: Reporter) extends Global(currentSettings, reporter) { + override lazy val analyzer = new { + val global: CustomGlobal.this.type = CustomGlobal.this + } with Analyzer { + override def newTyper(context: Context): Typer = new CustomTyper(context) + + class CustomTyper(context : Context) extends Typer(context) { + override def typed(tree: Tree, mode: Mode, pt: Type): Tree = { + if (tree.summaryString contains "Bippy") + println("I'm typing a Bippy! It's a " + tree.shortClass + ".") + + super.typed(tree, mode, pt) + } + } + } +} diff --git a/tests/pending/pos/annotations.scala b/tests/pending/pos/annotations.scala index 9235a1ee65bd..be15a3dcbbeb 100644 --- a/tests/pending/pos/annotations.scala +++ b/tests/pending/pos/annotations.scala @@ -1,3 +1,5 @@ +// Needs an implementation of beanproperty to work + class ann(i: Int) extends scala.annotation.Annotation class cfann(x: String) extends annotation.ClassfileAnnotation