diff options
Diffstat (limited to 'src/dotty/tools/dotc/Compiler.scala')
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index d0d43a541..3355ce1f2 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -16,6 +16,33 @@ import dotty.tools.dotc.core.Denotations.SingleDenotation class Compiler { + /** Meta-ordering constraint: + * + * DenotTransformers that change the signature of their denotation's info must go + * after erasure. The reason is that denotations are permanently referred to by + * TermRefs which contain a signature. If the signature of a symbol would change, + * all refs to it would become outdated - they could not be dereferenced in the + * new phase. + * + * As an example, addGetters would change a field + * + * val x: T + * + * to a method + * + * def x: T + * + * but this would affect the signature of `x` (goes from NotAMethod to a method + * signature). So we can't do this before erasure. + * + * After erasure, signature changing denot-transformers are OK because erasure + * will make sure that only term refs with fixed SymDenotations survive beyond it. This + * is possible because: + * + * - splitter has run, so every ident or select refers to a unique symbol + * - after erasure, asSeenFrom is the identity, so every reference has a + * plain SymDenotation, as opposed to a UniqueRefDenotation. + */ def phases: List[List[Phase]] = List( List(new FrontEnd), |