Skip to content

Commit 02ff21e

Browse files
committed
docs
1 parent 5358c36 commit 02ff21e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/compiler/scala/tools/nsc/transform/Mixin.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,23 @@ import scala.collection.{ mutable, immutable }
1414
*
1515
* So far, we've tried to treat classes and traits in the same way as much as possible.
1616
* Except, for traits:
17-
* - no field symbols are entered (pretend the val is abstract)
18-
* - lazy val is an abstract getter and a concrete method to compute the rhs (and perform its side-effects)
19-
* - accessors for fields, outer pointers and super calls are abstract
17+
* - Fields have been removed during Constructors, which also made their accessors abstract,
18+
* while setting the MIXEDIN flag to track that the accessors need to be implemented here.
19+
* (Constructors needs to see the fields to the init code to the constructor.
20+
* Note that getters for vals without storage are concrete already in the trait -- see `typeNeedsNoStorage`)
21+
* - An outer accessor is abstract
22+
* - A super accessor is abstract
23+
* - A lazy val is an abstract getter and a concrete method to compute the rhs (and perform its side-effects)
24+
* - TODO: (lifted) objects
2025
*
2126
* In classes that extends traits, it's time to face the music:
22-
* - an overriding method is added for each trait method definition with the override keyword (TODO: refine)
27+
* - an overriding method is added for each trait method definition with the override keyword,
28+
* as well as for each method that occurs more than once in the linearisation:
29+
* ```trait A { def foo }; trait B { def foo}; class C extends A with B { /* must override foo */ }```
2330
* - fields are created
2431
* - accessors are implemented (for fields, outers & supers)
2532
* - lazy vals get bitmaps, getter does its lazy thing, using the compute method in the trait
33+
* - TODO: (lifted) objects
2634
*
2735
*
2836
*/

0 commit comments

Comments
 (0)