Skip to content

Commit 26338a7

Browse files
cuonglmgopherbot
authored andcommitted
cmd/compile: use better fatal message for staticValue1
So the position of the wrong assignment statement will be reported, instead of using incorrect base.Pos one. Notice while fixing issue #73823. Change-Id: I53f240bf99d11b5f5082ee4ca0903d9f099881b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/675495 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Mateusz Poliwczak <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 8587ba2 commit 26338a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cmd/compile/internal/ir/expr.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,12 +912,12 @@ FindRHS:
912912
break FindRHS
913913
}
914914
}
915-
base.Fatalf("%v missing from LHS of %v", n, defn)
915+
base.FatalfAt(defn.Pos(), "%v missing from LHS of %v", n, defn)
916916
default:
917917
return nil
918918
}
919919
if rhs == nil {
920-
base.Fatalf("RHS is nil: %v", defn)
920+
base.FatalfAt(defn.Pos(), "RHS is nil: %v", defn)
921921
}
922922

923923
if Reassigned(n) {

src/cmd/compile/internal/ir/reassignment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ FindRHS:
178178
break FindRHS
179179
}
180180
}
181-
base.Fatalf("%v missing from LHS of %v", n, defn)
181+
base.FatalfAt(defn.Pos(), "%v missing from LHS of %v", n, defn)
182182
default:
183183
return nil
184184
}
185185
if rhs == nil {
186-
base.Fatalf("RHS is nil: %v", defn)
186+
base.FatalfAt(defn.Pos(), "RHS is nil: %v", defn)
187187
}
188188

189189
if _, ok := ro.singleDef[n]; !ok {

0 commit comments

Comments
 (0)