1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:56:47 -07:00

cmd/compile: do some TODOs about Fatalf

Separate CL in case I'm mistaken.

Change-Id: I6b5fa0efb27a6b4fb4c133698bd7e2f01b4cccdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/521195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Matthew Dempsky 2023-08-19 22:32:08 -07:00 committed by Gopher Robot
parent caf9e15fb7
commit d1593b7a4a
2 changed files with 10 additions and 8 deletions

View File

@ -129,11 +129,7 @@ func staticCall(call *ir.CallExpr) {
call.SetOp(ir.OCALLINTER)
call.X = x
default:
// TODO(mdempsky): Turn back into Fatalf after more testing.
if base.Flag.LowerM != 0 {
base.WarnfAt(call.Pos(), "failed to devirtualize %v (%v)", x, x.Op())
}
return
base.FatalfAt(call.Pos(), "failed to devirtualize %v (%v)", x, x.Op())
}
// Duplicated logic from typecheck for function call return

View File

@ -469,7 +469,9 @@ func dot(pos src.XPos, typ *types.Type, op ir.Op, x ir.Node, selection *types.Fi
// inserted too.
func XDotField(pos src.XPos, x ir.Node, sym *types.Sym) *ir.SelectorExpr {
n := Expr(ir.NewSelectorExpr(pos, ir.OXDOT, x, sym)).(*ir.SelectorExpr)
// TODO(mdempsky): Assert n is ODOT/ODOTPTR.
if n.Op() != ir.ODOT && n.Op() != ir.ODOTPTR {
base.FatalfAt(pos, "unexpected result op: %v (%v)", n.Op(), n)
}
return n
}
@ -483,10 +485,14 @@ func XDotMethod(pos src.XPos, x ir.Node, sym *types.Sym, callee bool) *ir.Select
n := ir.NewSelectorExpr(pos, ir.OXDOT, x, sym)
if callee {
n = Callee(n).(*ir.SelectorExpr)
// TODO(mdempsky): Assert n is ODOTMETH/ODOTINTER.
if n.Op() != ir.ODOTMETH && n.Op() != ir.ODOTINTER {
base.FatalfAt(pos, "unexpected result op: %v (%v)", n.Op(), n)
}
} else {
n = Expr(n).(*ir.SelectorExpr)
// TODO(mdempsky): Assert n is OMETHVALUE.
if n.Op() != ir.OMETHVALUE {
base.FatalfAt(pos, "unexpected result op: %v (%v)", n.Op(), n)
}
}
return n
}