}
func (check *Checker) initConst(lhs *Const, x *operand) {
- if x.mode == invalid || lhs.typ == Typ[Invalid] {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
if lhs.typ == nil {
lhs.typ = Typ[Invalid]
}
// If lhs doesn't have a type yet, it is given the type of x,
// or Typ[Invalid] in case of an error.
func (check *Checker) initVar(lhs *Var, x *operand, context string) {
- if x.mode == invalid || lhs.typ == Typ[Invalid] {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
if lhs.typ == nil {
lhs.typ = Typ[Invalid]
}
v.used = v_used // restore v.used
}
+ if x.mode == invalid || x.typ == Typ[Invalid] {
+ return Typ[Invalid]
+ }
+
// spec: "Each left-hand side operand must be addressable, a map index
// expression, or the blank identifier. Operands may be parenthesized."
switch x.mode {
}
func (check *Checker) initConst(lhs *Const, x *operand) {
- if x.mode == invalid || lhs.typ == Typ[Invalid] {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
if lhs.typ == nil {
lhs.typ = Typ[Invalid]
}
// If lhs doesn't have a type yet, it is given the type of x,
// or Typ[Invalid] in case of an error.
func (check *Checker) initVar(lhs *Var, x *operand, context string) {
- if x.mode == invalid || lhs.typ == Typ[Invalid] {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
if lhs.typ == nil {
lhs.typ = Typ[Invalid]
}
v.used = v_used // restore v.used
}
+ if x.mode == invalid || x.typ == Typ[Invalid] {
+ return Typ[Invalid]
+ }
+
// spec: "Each left-hand side operand must be addressable, a map index
// expression, or the blank identifier. Operands may be parenthesized."
switch x.mode {