aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-06-21 05:22:00 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-06-23 21:53:52 +0000
commitc70e93ff3d1855b0d0a0508ab83dd751ee65f5b3 (patch)
tree90f956042b983e65da25f07b596f4f3df9a38837 /src/cmd/compile/internal
parent20e1d5ac8cc269c8fc40d08e0b9e14ffe99d19d3 (diff)
downloadgo-c70e93ff3d1855b0d0a0508ab83dd751ee65f5b3.tar.xz
[dev.unified] cmd/compile/internal/typecheck: replace unreachable code with assert
Since the removal of -G=0 mode, IR is always well-typed. And in well-typed IR, convlit will always returns expressions having real types (i.e., not untyped). Change-Id: I1ac99a88c94777829852519347a716d19af7948c Reviewed-on: https://go-review.googlesource.com/c/go/+/413363 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r--src/cmd/compile/internal/typecheck/subr.go18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go
index 3b0075e616..8295a4e560 100644
--- a/src/cmd/compile/internal/typecheck/subr.go
+++ b/src/cmd/compile/internal/typecheck/subr.go
@@ -301,24 +301,14 @@ func assignconvfn(n ir.Node, t *types.Type, context func() string) ir.Node {
n = convlit1(n, t, false, context)
if n.Type() == nil {
- return n
+ base.Fatalf("cannot assign %v to %v", n, t)
+ }
+ if n.Type().IsUntyped() {
+ base.Fatalf("%L has untyped type", n)
}
if t.Kind() == types.TBLANK {
return n
}
-
- // Convert ideal bool from comparison to plain bool
- // if the next step is non-bool (like interface{}).
- if n.Type() == types.UntypedBool && !t.IsBoolean() {
- if n.Op() == ir.ONAME || n.Op() == ir.OLITERAL {
- r := ir.NewConvExpr(base.Pos, ir.OCONVNOP, nil, n)
- r.SetType(types.Types[types.TBOOL])
- r.SetTypecheck(1)
- r.SetImplicit(true)
- n = r
- }
- }
-
if types.Identical(n.Type(), t) {
return n
}