diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-10-11 07:20:47 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-10-11 07:20:47 +0000 |
commit | 72cf31c7acf46b1073d0c1e2ab6a87b55b7e92f5 (patch) | |
tree | a7f49763e4db0d7b9099726c6b48a1d382abb782 | |
parent | a350673750d431c4f6159c908e3aca4af43057c4 (diff) | |
download | scala-72cf31c7acf46b1073d0c1e2ab6a87b55b7e92f5.tar.gz scala-72cf31c7acf46b1073d0c1e2ab6a87b55b7e92f5.tar.bz2 scala-72cf31c7acf46b1073d0c1e2ab6a87b55b7e92f5.zip |
temporary fix for compiler crash in dependend m...
temporary fix for compiler crash in dependend method types with
annotations. review by moors.
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 8 | ||||
-rw-r--r-- | test/files/pos/annotDepMethType.flags | 1 | ||||
-rw-r--r-- | test/files/pos/annotDepMethType.scala | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index d4f322ed9f..8f72bdcde6 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -3605,8 +3605,12 @@ A type's typeSymbol should never be inspected directly. override def transform(tree: Tree): Tree = { tree match { case RefParamAt(pid) => - if(actuals(pid) isStable) mkAttributedQualifier(actuals(pid), tree.symbol) - else { + // TODO: this should be simplified; in the stable case, one can probably + // just use an Ident to the tree.symbol. Why an existential in the non-stable case? + val actual = actuals(pid) + if(actual.isStable && actual.typeSymbol != NothingClass) { + mkAttributedQualifier(actuals(pid), tree.symbol) + } else { val sym = existSymFor(pid) (Ident(sym.name) copyAttrs tree diff --git a/test/files/pos/annotDepMethType.flags b/test/files/pos/annotDepMethType.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/pos/annotDepMethType.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/files/pos/annotDepMethType.scala b/test/files/pos/annotDepMethType.scala new file mode 100644 index 0000000000..b5e7cb9e8b --- /dev/null +++ b/test/files/pos/annotDepMethType.scala @@ -0,0 +1,7 @@ +case class pc(calls: Any*) extends TypeConstraint + +object Main { + class C0 { def baz: String = "" } + class C1 { def bar(c0: C0): String @pc(c0.baz) = c0.baz } + def trans(c1: C1): String @pc(c1.bar(throw new Error())) = c1.bar(new C0) +} |