From 474c0022b2ffee613a4bd835c81d551af4764f31 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 8 Aug 2017 14:04:25 +0200 Subject: [PATCH 1/2] Fix #2949: Change order of elaboration Swap the order in which the constructor or a class is elaborated relative to indexing the class contents. The change indexes first, which fixes #2949. --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 7dd741666cdb..6976de7225ba 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -909,9 +909,9 @@ class Namer { typer: Typer => // the parent types are elaborated. index(constr) annotate(constr :: params) - symbolOfTree(constr).ensureCompleted() indexAndAnnotate(rest)(inClassContext(selfInfo)) + symbolOfTree(constr).ensureCompleted() val parentTypes = ensureFirstIsClass(parents.map(checkedParentType(_))) val parentRefs = ctx.normalizeToClassRefs(parentTypes, cls, decls) From 6390e9a6fc2ec36308cdd592c09e2069ffc335c0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 8 Aug 2017 14:06:36 +0200 Subject: [PATCH 2/2] Add test file --- tests/pos/i2949.scala | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/pos/i2949.scala diff --git a/tests/pos/i2949.scala b/tests/pos/i2949.scala new file mode 100644 index 000000000000..bd493d46ec47 --- /dev/null +++ b/tests/pos/i2949.scala @@ -0,0 +1,3 @@ +class Foo(a: Foo#A) { + type A = Int +}