Skip to content

Commit cec6467

Browse files
committed
Merge pull request #1249 from dotty-staging/change-early-annots
Evaluate annotations before completing tree of definitions
2 parents 3e3df65 + a5ae15e commit cec6467

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ class Namer { typer: Typer =>
562562
* to pick up the context at the point where the completer was created.
563563
*/
564564
def completeInCreationContext(denot: SymDenotation): Unit = {
565-
denot.info = typeSig(denot.symbol)
566565
addAnnotations(denot)
566+
denot.info = typeSig(denot.symbol)
567567
Checking.checkWellFormed(denot.symbol)
568568
}
569569
}
@@ -670,6 +670,8 @@ class Namer { typer: Typer =>
670670
ok
671671
}
672672

673+
addAnnotations(denot)
674+
673675
val selfInfo =
674676
if (self.isEmpty) NoType
675677
else if (cls.is(Module)) {
@@ -699,7 +701,6 @@ class Namer { typer: Typer =>
699701

700702
index(rest)(inClassContext(selfInfo))
701703
denot.info = ClassInfo(cls.owner.thisType, cls, parentRefs, decls, selfInfo)
702-
addAnnotations(denot)
703704
Checking.checkWellFormed(cls)
704705
if (isDerivedValueClass(cls)) cls.setFlag(Final)
705706
cls.setApplicableFlags(

src/strawman/collections/CollectionStrawMan4.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import annotation.tailrec
1212
* strengths and weaknesses of different collection architectures.
1313
*
1414
* For a test file, see tests/run/CollectionTests.scala.
15+
*
16+
* Strawman4 is like strawman1, but built over views instead of by-name iterators
1517
*/
1618
object CollectionStrawMan4 {
1719

src/strawman/collections/CollectionStrawMan5.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import annotation.tailrec
1212
* strengths and weaknesses of different collection architectures.
1313
*
1414
* For a test file, see tests/run/CollectionTests.scala.
15+
*
16+
* Strawman5 is like strawman4, but using inheritance through ...Like traits
17+
* instead of decorators.
18+
*
19+
* Advantage: Much easier to specialize. See partition for strict (buildable) collections
20+
* or drop for Lists.
21+
*
22+
* Disadvantage: More "weird" types in base traits; some awkwardness with
23+
* @uncheckedVariance.
1524
*/
1625
object CollectionStrawMan5 {
1726

0 commit comments

Comments
 (0)