From 298a3e87823ab83a807ba80cc6563e50088c16da Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 10 May 2016 23:28:16 +0200 Subject: Evaluate annotations before completing tree of definitions Motive: That way we can identify annotation macros without special name resolution rules. This was surprisingly easy. --- src/dotty/tools/dotc/typer/Namer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 82b3b56e9..d9da2b0ad 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -562,8 +562,8 @@ class Namer { typer: Typer => * to pick up the context at the point where the completer was created. */ def completeInCreationContext(denot: SymDenotation): Unit = { - denot.info = typeSig(denot.symbol) addAnnotations(denot) + denot.info = typeSig(denot.symbol) Checking.checkWellFormed(denot.symbol) } } -- cgit v1.2.3 From 428642afa331fafaffa90880fc9352d6fb366a84 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 12 May 2016 17:32:59 +0200 Subject: Explain specific changes in later strawman proposals ... relative to CollectionStrawman1. --- src/strawman/collections/CollectionStrawMan4.scala | 2 ++ src/strawman/collections/CollectionStrawMan5.scala | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/strawman/collections/CollectionStrawMan4.scala b/src/strawman/collections/CollectionStrawMan4.scala index 874f67a2d..ec20849ff 100644 --- a/src/strawman/collections/CollectionStrawMan4.scala +++ b/src/strawman/collections/CollectionStrawMan4.scala @@ -12,6 +12,8 @@ import annotation.tailrec * strengths and weaknesses of different collection architectures. * * For a test file, see tests/run/CollectionTests.scala. + * + * Strawman4 is like strawman1, but built over views instead of by-name iterators */ object CollectionStrawMan4 { diff --git a/src/strawman/collections/CollectionStrawMan5.scala b/src/strawman/collections/CollectionStrawMan5.scala index 1a89d9659..5d04c2c98 100644 --- a/src/strawman/collections/CollectionStrawMan5.scala +++ b/src/strawman/collections/CollectionStrawMan5.scala @@ -12,6 +12,15 @@ import annotation.tailrec * strengths and weaknesses of different collection architectures. * * For a test file, see tests/run/CollectionTests.scala. + * + * Strawman5 is like strawman4, but using inheritance through ...Like traits + * instead of decorators. + * + * Advantage: Much easier to specialize. See partition for strict (buildable) collections + * or drop for Lists. + * + * Disadvantage: More "weird" types in base traits; some awkwardness with + * @uncheckedVariance. */ object CollectionStrawMan5 { -- cgit v1.2.3 From a5ae15e2943bd5319c86c1fc01753fc2ceeb36d6 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 13 May 2016 17:36:03 +0200 Subject: Add class annotations as first step of completing the class. --- src/dotty/tools/dotc/typer/Namer.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index d9da2b0ad..a540b6ea5 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -670,6 +670,8 @@ class Namer { typer: Typer => ok } + addAnnotations(denot) + val selfInfo = if (self.isEmpty) NoType else if (cls.is(Module)) { @@ -699,7 +701,6 @@ class Namer { typer: Typer => index(rest)(inClassContext(selfInfo)) denot.info = ClassInfo(cls.owner.thisType, cls, parentRefs, decls, selfInfo) - addAnnotations(denot) Checking.checkWellFormed(cls) if (isDerivedValueClass(cls)) cls.setFlag(Final) cls.setApplicableFlags( -- cgit v1.2.3