@@ -216,9 +216,18 @@ class Namer { typer: Typer =>
216
216
checkNoConflict(name)
217
217
val deferred = if (lacksDefinition(tree)) Deferred else EmptyFlags
218
218
val method = if (tree.isInstanceOf [DefDef ]) Method else EmptyFlags
219
+
220
+ // to complete a constructor, move one context further out -- this
221
+ // is the context enclosing the class. Note that the context in which a
222
+ // constructor is recorded and the context in which it is completed are
223
+ // different: The former must have the class as owner (because the
224
+ // constructor is owned by the class), the latter must not (because
225
+ // constructor parameters are interpreted as if they are outside the class).
226
+ val cctx = if (tree.name == nme.CONSTRUCTOR ) ctx.outer else ctx
227
+
219
228
record(ctx.newSymbol(
220
229
ctx.owner, name, tree.mods.flags | deferred | method,
221
- adjustIfModule(new Completer (tree), tree),
230
+ adjustIfModule(new Completer (tree)(cctx) , tree),
222
231
privateWithinClass(tree.mods), tree.pos))
223
232
case tree : Import =>
224
233
record(ctx.newSymbol(
@@ -614,6 +623,7 @@ class Namer { typer: Typer =>
614
623
615
624
def typeDefSig (tdef : TypeDef , sym : Symbol )(implicit ctx : Context ): Type = {
616
625
completeParams(tdef.tparams)
626
+ sym.info = TypeBounds .empty // avoid cyclic reference errors for F-bounds
617
627
val tparamSyms = tdef.tparams map symbolOfTree
618
628
val rhsType = typedAheadType(tdef.rhs).tpe
619
629
0 commit comments