File tree Expand file tree Collapse file tree 5 files changed +23
-4
lines changed
reflect/scala/reflect/internal Expand file tree Collapse file tree 5 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ trait CompilationUnits { global: Global =>
52
52
* To get their sourcefiles, you need to dereference with .sourcefile
53
53
*/
54
54
private [this ] val _depends = mutable.HashSet [Symbol ]()
55
- // SBT compatibility (SI-6875)
55
+ // SBT compatibility -- pre-name-hashing dependency tracking for incremental compilation in sbt (SI-6875)
56
56
//
57
57
// imagine we have a file named A.scala, which defines a trait named Foo and a module named Main
58
58
// Main contains a call to a macro, which calls compileLate to define a mock for Foo
Original file line number Diff line number Diff line change @@ -14,8 +14,10 @@ import symtab.Flags._
14
14
/** This phase converts classes with parameters into Java-like classes with
15
15
* fields, which are assigned to from constructors.
16
16
*
17
- * TODO: for traits, we drop field definitions,
18
- * introducing trait field setters to abstract over them in the init method
17
+ * TODO: traits
18
+ * - drop field definitions,
19
+ * - introduce trait field setters to abstract over them in the init method
20
+ *
19
21
* mixins will add back fields and implementations for the setters to
20
22
* the classes that immediately extend the given trait
21
23
*/
Original file line number Diff line number Diff line change @@ -10,6 +10,22 @@ import symtab._
10
10
import reflect .internal .Flags ._
11
11
import scala .collection .{ mutable , immutable }
12
12
13
+ /** TODO: this describes my current goal for the trait-default scheme, not (yet) the actual implementation
14
+ *
15
+ * So far, we've tried to treat classes and traits in the same way as much as possible.
16
+ * 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
20
+ *
21
+ * 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)
23
+ * - fields are created
24
+ * - accessors are implemented (for fields, outers & supers)
25
+ * - lazy vals get bitmaps, getter does its lazy thing, using the compute method in the trait
26
+ *
27
+ *
28
+ */
13
29
abstract class Mixin extends InfoTransform with ast.TreeDSL {
14
30
import global ._
15
31
import definitions ._
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ trait Infer extends Checkable {
257
257
case NoSymbol if sym.isJavaDefined && context.unit.isJava => sym // don't try to second guess Java; see #4402
258
258
case sym1 => sym1
259
259
}
260
- // XXX So... what's this for exactly?
260
+ // Pre-name-hashing dependency tracking for incremental compilation in sbt.
261
261
if (context.unit.exists)
262
262
context.unit.depends += sym.enclosingTopLevelClass
263
263
Original file line number Diff line number Diff line change @@ -934,6 +934,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
934
934
(owner.isTrait || owner.isImplClass) && (
935
935
hasAllFlags(LIFTED | MODULE | METHOD )
936
936
|| isConstructor
937
+ // (not-private || lifted) && !accessor && !superAccessor && !module
937
938
|| hasFlag(notPRIVATE | LIFTED ) && ! hasFlag(ACCESSOR | SUPERACCESSOR | MODULE )
938
939
)
939
940
)
You can’t perform that action at this time.
0 commit comments