aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-07-27 23:26:58 -0700
committerGitHub <noreply@github.com>2016-07-27 23:26:58 -0700
commit79e0fe02708a115140f53678499c423c773123c4 (patch)
tree4388cd4c3d03bd48058466cf9b4a41abf048ecf7 /src/dotty/tools/dotc/core
parent48d6460865f4b83e6df42551ce55319805ad7342 (diff)
parent04e6d5e5ad39d046a977de1bfd4563287e5b0f41 (diff)
downloaddotty-79e0fe02708a115140f53678499c423c773123c4.tar.gz
dotty-79e0fe02708a115140f53678499c423c773123c4.tar.bz2
dotty-79e0fe02708a115140f53678499c423c773123c4.zip
Merge pull request #1289 from dotty-staging/fix/partest-separate
partest: Enable separate compilation
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala3
-rw-r--r--src/dotty/tools/dotc/core/classfile/ClassfileParser.scala18
2 files changed, 17 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 7211c0a9b..054c67e7e 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2645,6 +2645,9 @@ object Types {
if (ctx.period != validSuper) {
cachedSuper = tycon match {
case tp: TypeLambda => defn.AnyType
+ case tp: TypeVar if !tp.inst.exists =>
+ // supertype not stable, since underlying might change
+ return tp.underlying.applyIfParameterized(args)
case tp: TypeProxy => tp.superType.applyIfParameterized(args)
case _ => defn.AnyType
}
diff --git a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
index 813376655..a6d381693 100644
--- a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
@@ -580,9 +580,6 @@ class ClassfileParser(
* parameters. For Java annotations we need to fake it by making up the constructor.
* Note that default getters have type Nothing. That's OK because we need
* them only to signal that the corresponding parameter is optional.
- * If the constructor takes as last parameter an array, it can also accept
- * a vararg argument. We solve this by creating two constructors, one with
- * an array, the other with a repeated parameter.
*/
def addAnnotationConstructor(classInfo: Type, tparams: List[TypeSymbol] = Nil)(implicit ctx: Context): Unit = {
def addDefaultGetter(attr: Symbol, n: Int) =
@@ -618,13 +615,26 @@ class ClassfileParser(
}
addConstr(paramTypes)
+
+ // The code below added an extra constructor to annotations where the
+ // last parameter of the constructor is an Array[X] for some X, the
+ // array was replaced by a vararg argument. Unfortunately this breaks
+ // inference when doing:
+ // @Annot(Array())
+ // The constructor is overloaded so the expected type of `Array()` is
+ // WildcardType, and the type parameter of the Array apply method gets
+ // instantiated to `Nothing` instead of `X`.
+ // I'm leaving this commented out in case we improve inference to make this work.
+ // Note that if this is reenabled then JavaParser will also need to be modified
+ // to add the extra constructor (this was not implemented before).
+ /*
if (paramTypes.nonEmpty)
paramTypes.last match {
case defn.ArrayOf(elemtp) =>
addConstr(paramTypes.init :+ defn.RepeatedParamType.appliedTo(elemtp))
case _ =>
}
-
+ */
}
}