You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packagecom.tribbloids.spike.dottyobjectPrivateEscapingScope {
traitT1 {
objectR1extendsProducttypeR1=R1.type
}
traitK1 {
privatelazyvalt1:T1=newT1 {}
defr1= t1.R1// the only difference with K2 is lazy caching/** * non-private method r1 in trait K1 refers to private lazy value t1 in its type signature => K1.this.t1.R1.type * def r1 = t1.R1 // the only difference with K2 is lazy caching*/
}
typeT1R1=T1#R1traitK1_2 {
privatelazyvalt1:T1=newT1 {}
defr1:T1#R1= t1.R1/** * Found: K1_2.this.t1.R1.type * * Required: com.tribbloids.spike.dotty.PrivateEscapingScope.T1#R1 * * Explanation \=========== * * Tree: this.t1.R1 I tried to show that K1_2.this.t1.R1.type conforms to * com.tribbloids.spike.dotty.PrivateEscapingScope.T1#R1 but none of the attempts shown below succeeded: * * \==> K1_2.this.t1.R1.type <: com.tribbloids.spike.dotty.PrivateEscapingScope.T1#R1 CachedTermRef CachedTypeRef * \==> object K1_2.this.t1.R1 <: com.tribbloids.spike.dotty.PrivateEscapingScope.T1#R1 CachedTypeRef CachedTypeRef * \= false * * The tests were made under the empty constraint * * def r1: T1#R1 = t1.R1*/
}
traitK1_3 {
privatelazyvalt1:T1=newT1 {}
defr1:Product= t1.R1// success: explicitly widen to Product
}
traitK2 {
privatedeft1:T1=newT1 {}
defr1= t1.R1// success: widen to T1#R1
}
}
Output
both K1 and K1_2 fail to compile, because K1.t1 has a path but K2.t1 doesn't
K1_2 in addition displayed a strange error message, this may be caused by the simple type projection T1#R1, which is not DOT logic but legal in Scala 3
Expectation
Both T1 and T1_2 should compile successfully, since t1 is a private path, r1 should automatically be widen to T1#R1 or Product
The text was updated successfully, but these errors were encountered:
Compiler version
3.6.2
Minimized code
Output
both
K1
andK1_2
fail to compile, because K1.t1 has a path but K2.t1 doesn'tK1_2
in addition displayed a strange error message, this may be caused by the simple type projectionT1#R1
, which is not DOT logic but legal in Scala 3Expectation
Both T1 and T1_2 should compile successfully, since t1 is a private path, r1 should automatically be widen to
T1#R1
orProduct
The text was updated successfully, but these errors were encountered: