Skip to content

Commit 178cb76

Browse files
committed
docs
1 parent 7a583bb commit 178cb76

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

src/compiler/scala/tools/nsc/CompilationUnits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ trait CompilationUnits { global: Global =>
5252
* To get their sourcefiles, you need to dereference with .sourcefile
5353
*/
5454
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)
5656
//
5757
// imagine we have a file named A.scala, which defines a trait named Foo and a module named Main
5858
// Main contains a call to a macro, which calls compileLate to define a mock for Foo

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import symtab.Flags._
1414
/** This phase converts classes with parameters into Java-like classes with
1515
* fields, which are assigned to from constructors.
1616
*
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+
*
1921
* mixins will add back fields and implementations for the setters to
2022
* the classes that immediately extend the given trait
2123
*/

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ import symtab._
1010
import reflect.internal.Flags._
1111
import scala.collection.{ mutable, immutable }
1212

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+
*/
1329
abstract class Mixin extends InfoTransform with ast.TreeDSL {
1430
import global._
1531
import definitions._

src/compiler/scala/tools/nsc/typechecker/Infer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ trait Infer extends Checkable {
257257
case NoSymbol if sym.isJavaDefined && context.unit.isJava => sym // don't try to second guess Java; see #4402
258258
case sym1 => sym1
259259
}
260-
// XXX So... what's this for exactly?
260+
// Pre-name-hashing dependency tracking for incremental compilation in sbt.
261261
if (context.unit.exists)
262262
context.unit.depends += sym.enclosingTopLevelClass
263263

src/reflect/scala/reflect/internal/Symbols.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
934934
(owner.isTrait || owner.isImplClass) && (
935935
hasAllFlags(LIFTED | MODULE | METHOD)
936936
|| isConstructor
937+
// (not-private || lifted) && !accessor && !superAccessor && !module
937938
|| hasFlag(notPRIVATE | LIFTED) && !hasFlag(ACCESSOR | SUPERACCESSOR | MODULE)
938939
)
939940
)

0 commit comments

Comments
 (0)