|
Re: Trouble with intersection types: msg#00453lang.scala
Miles, It's not a compiler bug, but it is not that obvious either. You expected that the intersection DerivedModule1 with DerivedModule2 applies both inherited constraints to its `t' member. I.e. that type t <: DerivedT1 with DerivedT2 would hold. That's not how things work (at least for now). A compound type simply inherits its member from the last inherited parent, i.e. for type t: type t <: DerivedT2 You need to define the richer constraint explicitly if you want it. I.e. the following should work: def run12(m : DerivedModule1 with DerivedModule2 { type t <: DerivedT1 with DerivedT2 }) = { val t = m.newT t.derivedT1 // should be OK now. t.derivedT2 } } Now, it's perfectly reasonable to expect the behavior you assumed. In fact, this would be a special case of "deep mixin composition", which is on our to do list. Cheers -- Martin |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Trouble with intersection types: 00453, Miles Sabin |
|---|---|
| Next by Date: | Re: assorted beginner questions: 00453, Rafael de F. Ferreira |
| Previous by Thread: | Trouble with intersection typesi: 00453, Miles Sabin |
| Next by Thread: | emulating Smalltalk syntax in Scala: snippet: 00453, Adriaan Moors |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |