| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Scala
Revision: 16025
Author: odersky
Date: 04 Sep 2008 13:05:28
Diff at Trac: https://lampsvn.epfl.ch/trac/scala/changeset/16025
Changes:disabled volatile checks because eclipse plugin build breaks.
Files:| ... | ...@@ -1159,10 +1159,12 @@ | |
| 1159 | 1159 | decls)) |
| 1160 | 1160 | else super.normalize |
| 1161 | 1161 | |
| 1162 | override def isVolatile = | |
| 1162 | override def isVolatile = false // for now; this should really be: | |
| 1163 | /* | |
| 1163 | 1164 | !parents.isEmpty && |
| 1164 | 1165 | (!parents.tail.isEmpty || !decls.isEmpty) && |
| 1165 | 1166 | (parents exists (_.typeSymbol.isAbstractType)) |
| 1167 | */ | |
| 1166 | 1168 | |
| 1167 | 1169 | override def kind = "RefinedType" |
| 1168 | 1170 | } |
| ... | ...@@ -2588,6 +2590,12 @@ | |
| 2588 | 2590 | } |
| 2589 | 2591 | } |
| 2590 | 2592 | |
| 2593 | def singletonBounds(hi: Type) = { | |
| 2594 | if (hi.isVolatile) | |
| 2595 | throw new MalformedType("cannot abstract over singleton with volatile type "+hi) | |
| 2596 | mkTypeBounds(NothingClass.tpe, intersectionType(List(hi, SingletonClass.tpe))) | |
| 2597 | } | |
| 2598 | ||
| 2591 | 2599 | /** A map to compute the asSeenFrom method */ |
| 2592 | 2600 | class AsSeenFromMap(pre: Type, clazz: Symbol) extends TypeMap { |
| 2593 | 2601 | override val dropNonConstraintAnnotations = true |
| ... | ...@@ -2628,8 +2636,7 @@ | |
| 2628 | 2636 | def stabilize(pre: Type, clazz: Symbol): Type = { |
| 2629 | 2637 | capturedPre get clazz match { |
| 2630 | 2638 | case None => |
| 2631 | val qvar = makeFreshExistential(".type", clazz, | |
| 2632 | mkTypeBounds(NothingClass.tpe, intersectionType(List(pre, SingletonClass.tpe)))) | |
| 2639 | val qvar = makeFreshExistential(".type", clazz, singletonBounds(pre)) | |
| 2633 | 2640 | capturedPre += (clazz -> qvar) |
| 2634 | 2641 | capturedParams = qvar :: capturedParams |
| 2635 | 2642 | qvar |
| ... | ...@@ -2904,11 +2911,6 @@ | |
| 2904 | 2911 | private var existSyms = immutable.Map.empty[Int, Symbol] |
| 2905 | 2912 | def existentialsNeeded: List[Symbol] = existSyms.values.toList |
| 2906 | 2913 | |
| 2907 | private def boundFor(actualIdx: Int) = | |
| 2908 | mkTypeBounds( | |
| 2909 | NothingClass.tpe, | |
| 2910 | intersectionType(List(actuals(actualIdx), SingletonClass.tpe))) | |
| 2911 | ||
| 2912 | 2914 | /* Return the type symbol for referencing a parameter index |
| 2913 | 2915 | * inside the existential quantifier. */ |
| 2914 | 2916 | def existSymFor(actualIdx: Int, oldSym: Symbol) = |
| ... | ...@@ -2916,11 +2918,10 @@ | |
| 2916 | 2918 | existSyms(actualIdx) |
| 2917 | 2919 | else { |
| 2918 | 2920 | val symowner = oldSym.owner // what should be used?? |
| 2919 | val bound = boundFor(actualIdx) | |
| 2921 | val bound = singletonBounds(actuals(actualIdx)) | |
| 2920 | 2922 | |
| 2921 | 2923 | val sym = |
| 2922 | symowner.newAbstractType( | |
| 2923 | oldSym.pos, oldSym.name+".type") | |
| 2924 | symowner.newAbstractType(oldSym.pos, oldSym.name+".type") | |
| 2924 | 2925 | |
| 2925 | 2926 | sym.setInfo(bound) |
| 2926 | 2927 | sym.setFlag(oldSym.flags) |
| ... | ...@@ -1,5 +0,0 @@ | |
| 1 | null-unsoundness.scala:8: error: stable identifier required, but A.this.x found. | |
| 2 | Note that value x is not stable because its type, A.this.D with A.this.A, is volatile. | |
| 3 | var y: x.T = new C("abc") | |
| 4 | ^ | |
| 5 | one error found |
| ... | ...@@ -3290,11 +3290,8 @@ | |
| 3290 | 3290 | tree setType ref1.tpe.resultType |
| 3291 | 3291 | |
| 3292 | 3292 | case SelectFromTypeTree(qual, selector) => |
| 3293 | /* maybe need to do this: | |
| 3294 | val res = typedSelect(typedType(qual, mode), selector) | |
| 3295 | tree setType res.tpe setSymbol res.symbol | |
| 3296 | res | |
| 3297 | */ | |
| 3293 | val qual1 = typedType(qual, mode) | |
| 3294 | if (qual1.tpe.isVolatile) error(tree.pos, "illegal type selection from volatile type "+qual.tpe) | |
| 3298 | 3295 | typedSelect(typedType(qual, mode), selector) |
| 3299 | 3296 | |
| 3300 | 3297 | case CompoundTypeTree(templ) => |
| ... | ...@@ -1,15 +0,0 @@ | |
| 1 | class B | |
| 2 | class C(x: String) extends B | |
| 3 | ||
| 4 | class A { | |
| 5 | type A >: Null | |
| 6 | class D { type T >: C <: B } | |
| 7 | val x: D with A = null | |
| 8 | var y: x.T = new C("abc") | |
| 9 | } | |
| 10 | object Test extends A with Application { | |
| 11 | class C { type T = Int; val x = 1 } | |
| 12 | type A = C | |
| 13 | y = 42 | |
| 14 | } | |
| 15 |