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
A compound type T1 with...with Tn {R} represents objects with members as
given in the component types T1 ,..., Tn and the refinement {R}. A refinement {R}
contains declarations and type definitions. If a declaration or definition overrides a
declaration or definition in one of the component types T1 ,..., Tn , the usual rules
for overriding (�5.1.4) apply;
5.1.4 Overriding
A member M of class C that matches (�5.1.3) a non-private member M' of a base
class of C is said to override that member. In this case the binding of the overriding
member M must subsume (�3.5.2) the binding of the overridden member M' .
5.1.3 Definition 5.1.4 A member definition M matches a member definition M' , if M and
M' bind the same name, and one of following holds.
Neither M nor M' is a method definition.
3.5.2 A declaration or definition in some compound type of class type C subsumes an-
other declaration of the same name in some compound type or class type C' , if one
of the following holds.
A type alias type t [T1 ,..., Tn ] = T subsumes a type alias
type t [T1 ,..., Tn ] = T' if T ≡ T' .
A type declaration type t [T1 ,..., Tn ] >: L <: U subsumes a type declaration
type t [T1 ,..., Tn ] >: L′ <: U' if L′ <: L and U <: U' .
this should give a type error according the spec;
since it is not specified when compound types need to adhere to the rules from the first paragraph above,
it would be reasonable to assume they should always adhere
I guess it's a spec issue, not an implementation one
see also #3419 and neg/bug1275
objectBug1275 {
traitSeq[+t] {
typeMyType[+t] <:Seq[t]
deff:MyType[t]
}
// illegal abstract type member refinement: changes the arity of MyType// the error is pretty strange, since the compiler forms the illegal type xs.MyType[a] anywaydefspan[a, s <:Seq[a] { typeMyType/*look ma, no type parameters!*/<: s } ](xs: s): s
= xs f
// ^// found : xs.MyType[a]// required: s
}
The text was updated successfully, but these errors were encountered:
from the spec:
A compound type T1 with...with Tn {R} represents objects with members as
given in the component types T1 ,..., Tn and the refinement {R}. A refinement {R}
contains declarations and type definitions. If a declaration or definition overrides a
declaration or definition in one of the component types T1 ,..., Tn , the usual rules
for overriding (�5.1.4) apply;
5.1.4 Overriding
A member M of class C that matches (�5.1.3) a non-private member M' of a base
class of C is said to override that member. In this case the binding of the overriding
member M must subsume (�3.5.2) the binding of the overridden member M' .
5.1.3 Definition 5.1.4 A member definition M matches a member definition M' , if M and
M' bind the same name, and one of following holds.
3.5.2 A declaration or definition in some compound type of class type C subsumes an-
other declaration of the same name in some compound type or class type C' , if one
of the following holds.
type t [T1 ,..., Tn ] = T' if T ≡ T' .
type t [T1 ,..., Tn ] >: L′ <: U' if L′ <: L and U <: U' .
code examples that say otherwise:
this should give a type error according the spec;
since it is not specified when compound types need to adhere to the rules from the first paragraph above,
it would be reasonable to assume they should always adhere
I guess it's a spec issue, not an implementation one
see also #3419 and neg/bug1275
The text was updated successfully, but these errors were encountered: