diff options
Diffstat (limited to 'sources/scalac/typechecker')
-rw-r--r-- | sources/scalac/typechecker/Analyzer.java | 14 | ||||
-rw-r--r-- | sources/scalac/typechecker/DeSugarize.java | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index d8bcef64f2..91be325a8a 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -1022,7 +1022,11 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { owntype = Type.ErrorType; } } else { - ((ValDef) tree).rhs = rhs = transform(rhs, EXPRmode); + if ((sym.flags & CASEACCESSOR) != 0) { + rhs.type = rhs.symbol().type(); + } else { + ((ValDef) tree).rhs = rhs = transform(rhs, EXPRmode); + } owntype = rhs.type; } popContext(); @@ -1429,12 +1433,13 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { qual = infer.mkTypeApply(qual, tparams, restype, Symbol.type(tparams)); uninst = tparams; } - Symbol sym = typeToConstructor(tree.pos, qual.type.lookup(name)); + Symbol sym = qual.type.lookup(name); if (sym.kind == NONE) { //System.out.println(qual.type + " has members " + qual.type.members());//DEBUG return error(tree.pos, decode(name) + " is not a member of " + qual.type.widen()); } else { + sym = typeToConstructor(tree.pos, sym); checkAccessible(tree.pos, sym, qual); sym.flags |= ACCESSED; if (!TreeInfo.isSelf(qual, context.enclClass.owner)) @@ -1835,10 +1840,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { Tree rhs1 = rhs; if (rhs != Tree.Empty) { pushContext(tree, sym, context.scope); - if ((sym.flags & CASEACCESSOR) != 0) - rhs1.type = rhs1.symbol().type(); - else - rhs1 = transform(rhs, EXPRmode, tpe1.type); + rhs1 = transform(rhs, EXPRmode, tpe1.type); popContext(); } sym.flags |= LOCKED; diff --git a/sources/scalac/typechecker/DeSugarize.java b/sources/scalac/typechecker/DeSugarize.java index 2a82dd0586..87cea76d13 100644 --- a/sources/scalac/typechecker/DeSugarize.java +++ b/sources/scalac/typechecker/DeSugarize.java @@ -714,7 +714,7 @@ public class DeSugarize implements Kinds, Modifiers { //vparam.symbol().initialize(); ts.append( make.ValDef( - vparam.pos, CASEACCESSOR, vparam.name, vparam.tpe, + vparam.pos, CASEACCESSOR, vparam.name, Tree.Empty, make.Ident(vparam.pos, vparam.name) .setSymbol(vparam.symbol()))); } |