Skip to content

Commit a65a6da

Browse files
committed
update
Change-Id: I2bc464114e862a2a2d65f41a483bdeb12818a49e
1 parent 3b2345c commit a65a6da

File tree

4 files changed

+378
-373
lines changed

4 files changed

+378
-373
lines changed

Diff for: src/cmd/compile/internal/ir/expr.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,9 @@ type TypeAssertExpr struct {
682682
// An internal/abi.TypeAssert descriptor to pass to the runtime.
683683
Descriptor *obj.LSym
684684

685-
// Emit a nilcheck on the Itab of X.
685+
// When set to true, then the ssagen package will emit a nilcheck on the itab, that
686+
// will lead to a nil check panic in case the itab is nil at runtime.
687+
// It must not be set for type asserts using the commaok form.
686688
EmitItabNilCheck bool
687689
}
688690

Diff for: src/cmd/compile/internal/ssagen/ssa.go

+3
Original file line numberDiff line numberDiff line change
@@ -5627,6 +5627,9 @@ func (s *state) dottype(n *ir.TypeAssertExpr, commaok bool) (res, resok *ssa.Val
56275627
}
56285628

56295629
if n.EmitItabNilCheck {
5630+
if commaok {
5631+
base.Fatalf("unexpected *ir.TypeAssertExpr with EmitItabNilCheck == true && commaok == true")
5632+
}
56305633
typs := s.f.Config.Types
56315634
iface = s.newValue2(
56325635
ssa.OpIMake,

0 commit comments

Comments
 (0)