File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
274
274
275
275
val tree1 = ownType match {
276
276
case ownType : NamedType if ! prefixIsElidable(ownType) =>
277
+ checkRealizable(ownType.prefix, tree.pos)
277
278
ref(ownType).withPos(tree.pos)
278
279
case _ =>
279
280
tree.withType(ownType)
@@ -991,6 +992,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
991
992
val impl1 = cpy.Template (impl)(constr1, parents1, self1, body1)
992
993
.withType(dummy.nonMemberTermRef)
993
994
checkVariance(impl1)
995
+ if (! cls.is(AbstractOrTrait )) checkRealizableBounds(cls.typeRef, cdef.pos)
994
996
assignType(cpy.TypeDef (cdef)(name, impl1, Nil ), cls)
995
997
996
998
// todo later: check that
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ class tests extends CompilerTest {
156
156
@ Test def neg_i705 = compileFile(negDir, " i705-inner-value-class" , xerrors = 7 )
157
157
@ Test def neg_i866 = compileFile(negDir, " i866" , xerrors = 2 )
158
158
@ Test def neg_i974 = compileFile(negDir, " i974" , xerrors = 2 )
159
- @ Test def neg_i1050 = compileFile(negDir, " i1050" , xerrors = 6 )
159
+ @ Test def neg_i1050 = compileFile(negDir, " i1050" , xerrors = 8 )
160
160
@ Test def neg_i1050a = compileFile(negDir, " i1050a" , xerrors = 2 )
161
161
@ Test def neg_moduleSubtyping = compileFile(negDir, " moduleSubtyping" , xerrors = 4 )
162
162
@ Test def neg_escapingRefs = compileFile(negDir, " escapingRefs" , xerrors = 2 )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ object Tiark1 {
40
40
trait B { type L >: Any }
41
41
trait U {
42
42
lazy val p : B
43
- def brand (x : Any ): p.L = x // error: not final
43
+ def brand (x : Any ): p.L = x // error: nonfinal lazy
44
44
}
45
45
trait V extends U {
46
46
lazy val p : A & B = ???
@@ -54,7 +54,7 @@ object Tiark2 {
54
54
trait U {
55
55
type X <: B
56
56
lazy val p : X
57
- def brand (x : Any ): p.L = x // error: not final
57
+ def brand (x : Any ): p.L = x // error: nonfinal lazy
58
58
}
59
59
trait V extends U {
60
60
type X = B & A
@@ -70,7 +70,7 @@ object Tiark3 {
70
70
type X <: B
71
71
def p2 : X
72
72
final lazy val p : X = p2
73
- def brand (x : Any ): p.L = x
73
+ def brand (x : Any ): p.L = x // error: underlying not concrete
74
74
}
75
75
trait V extends U {
76
76
type X = B with A
@@ -79,20 +79,18 @@ object Tiark3 {
79
79
val v = new V {}
80
80
v.brand(" boom!" ): Nothing
81
81
}
82
- /*
83
82
object Import {
84
83
trait A { type L <: Nothing }
85
84
trait B { type L >: Any }
86
85
trait U {
87
- val p: B
88
- def brand(x: Any): p.L = x // error: not final
89
- locally { import p._
86
+ lazy val p : B
87
+ locally { val x : p.L = ??? } // error: nonfinal lazy
88
+ locally {
89
+ import p ._
90
+ val x : L = ??? // error: nonfinal lazy
90
91
}
91
92
}
92
93
trait V extends U {
93
94
lazy val p : A & B = ???
94
- }
95
- val v = new V {}
96
- v.brand("boom!")
97
95
}
98
- */
96
+
You can’t perform that action at this time.
0 commit comments