equal
deleted
inserted
replaced
1172 if (tree.isImplicitlyTyped()) { |
1172 if (tree.isImplicitlyTyped()) { |
1173 //fixup local variable type |
1173 //fixup local variable type |
1174 v.type = chk.checkLocalVarType(tree, tree.init.type.baseType(), tree.name); |
1174 v.type = chk.checkLocalVarType(tree, tree.init.type.baseType(), tree.name); |
1175 } |
1175 } |
1176 } |
1176 } |
|
1177 if (tree.isImplicitlyTyped()) { |
|
1178 setSyntheticVariableType(tree, v.type); |
|
1179 } |
1177 } |
1180 } |
1178 result = tree.type = v.type; |
1181 result = tree.type = v.type; |
1179 } |
1182 } |
1180 finally { |
1183 finally { |
1181 chk.setLint(prevLint); |
1184 chk.setLint(prevLint); |
1346 : types.wildUpperBound(iterableParams.head); |
1349 : types.wildUpperBound(iterableParams.head); |
1347 } |
1350 } |
1348 } |
1351 } |
1349 if (tree.var.isImplicitlyTyped()) { |
1352 if (tree.var.isImplicitlyTyped()) { |
1350 Type inferredType = chk.checkLocalVarType(tree.var, elemtype, tree.var.name); |
1353 Type inferredType = chk.checkLocalVarType(tree.var, elemtype, tree.var.name); |
1351 if (inferredType.isErroneous()) { |
1354 setSyntheticVariableType(tree.var, inferredType); |
1352 tree.var.vartype = make.at(tree.var.vartype).Erroneous(); |
|
1353 } else { |
|
1354 tree.var.vartype = make.at(tree.var.vartype).Type(inferredType); |
|
1355 } |
|
1356 } |
1355 } |
1357 attribStat(tree.var, loopEnv); |
1356 attribStat(tree.var, loopEnv); |
1358 chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type); |
1357 chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type); |
1359 loopEnv.tree = tree; // before, we were not in loop! |
1358 loopEnv.tree = tree; // before, we were not in loop! |
1360 attribStat(tree.body, loopEnv); |
1359 attribStat(tree.body, loopEnv); |
2557 } |
2556 } |
2558 //reset previously set info |
2557 //reset previously set info |
2559 Type argType = arityMismatch ? |
2558 Type argType = arityMismatch ? |
2560 syms.errType : |
2559 syms.errType : |
2561 actuals.head; |
2560 actuals.head; |
2562 params.head.vartype = make.at(params.head).Type(argType); |
2561 setSyntheticVariableType(params.head, argType); |
2563 params.head.sym = null; |
2562 params.head.sym = null; |
2564 actuals = actuals.isEmpty() ? |
2563 actuals = actuals.isEmpty() ? |
2565 actuals : |
2564 actuals : |
2566 actuals.tail; |
2565 actuals.tail; |
2567 params = params.tail; |
2566 params = params.tail; |
4827 TreeInfo.diagnosticPositionFor(svuid, tree), Warnings.ConstantSVUID(c)); |
4826 TreeInfo.diagnosticPositionFor(svuid, tree), Warnings.ConstantSVUID(c)); |
4828 } |
4827 } |
4829 |
4828 |
4830 private Type capture(Type type) { |
4829 private Type capture(Type type) { |
4831 return types.capture(type); |
4830 return types.capture(type); |
|
4831 } |
|
4832 |
|
4833 private void setSyntheticVariableType(JCVariableDecl tree, Type type) { |
|
4834 if (type.isErroneous()) { |
|
4835 tree.vartype = make.at(Position.NOPOS).Erroneous(); |
|
4836 } else { |
|
4837 tree.vartype = make.at(Position.NOPOS).Type(type); |
|
4838 } |
4832 } |
4839 } |
4833 |
4840 |
4834 public void validateTypeAnnotations(JCTree tree, boolean sigOnly) { |
4841 public void validateTypeAnnotations(JCTree tree, boolean sigOnly) { |
4835 tree.accept(new TypeAnnotationsValidator(sigOnly)); |
4842 tree.accept(new TypeAnnotationsValidator(sigOnly)); |
4836 } |
4843 } |
5150 if (that.sym == null) { |
5157 if (that.sym == null) { |
5151 that.sym = new VarSymbol(0, that.name, that.type, syms.noSymbol); |
5158 that.sym = new VarSymbol(0, that.name, that.type, syms.noSymbol); |
5152 that.sym.adr = 0; |
5159 that.sym.adr = 0; |
5153 } |
5160 } |
5154 if (that.vartype == null) { |
5161 if (that.vartype == null) { |
5155 that.vartype = make.Erroneous(); |
5162 that.vartype = make.at(Position.NOPOS).Erroneous(); |
5156 } |
5163 } |
5157 super.visitVarDef(that); |
5164 super.visitVarDef(that); |
5158 } |
5165 } |
5159 |
5166 |
5160 @Override |
5167 @Override |