File tree 2 files changed +23
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -600,7 +600,7 @@ object SymDenotations {
600
600
601
601
/** Is this a denotation of a stable term (or an arbitrary type)? */
602
602
final def isStable (implicit ctx : Context ) =
603
- isType || is(Stable ) || ! (is(UnstableValue ) || info.isInstanceOf [ExprType ])
603
+ ! is( Ghost ) && ( isType || is(Stable ) || ! (is(UnstableValue ) || info.isInstanceOf [ExprType ]) )
604
604
605
605
/** Is this a "real" method? A real method is a method which is:
606
606
* - not an accessor
Original file line number Diff line number Diff line change
1
+ class X { type R }
2
+ class T (ghost val a : X )(val value : a.R ) // error
3
+
4
+ object App {
5
+ def coerce [U , V ](u : U ): V = {
6
+ trait X { type R >: U }
7
+ trait Y { type R = V }
8
+
9
+ class T [A <: X ](ghost val a : A )(val value : a.R ) // error
10
+
11
+ object O { lazy val x : Y & X = ??? } // warning
12
+
13
+ val a = new T [Y & X ](O .x)(u)
14
+ a.value
15
+ }
16
+
17
+ def main (args : Array [String ]): Unit = {
18
+ val x : Int = coerce[String , Int ](" a" )
19
+ println(x + 1 )
20
+
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments