// trace is only available in test mode - no need to record signature
default:
- unreachable()
+ panic("unreachable")
}
assert(x.mode != invalid)
case *Interface:
return isTypeParam(t)
case *Named, *Union:
- unreachable()
+ panic("unreachable")
}
return false
}
case _Complex:
code = InvalidComplex
default:
- unreachable()
+ panic("unreachable")
}
check.softErrorf(x, code, "%s not supported as argument to %s for go1.18 (see go.dev/issue/50937)", x, predeclaredFuncs[id].name)
x.id = exp.id
default:
check.dump("%v: unexpected object %v", atPos(e.Sel), exp)
- unreachable()
+ panic("unreachable")
}
x.expr = e
return
check.addDeclDep(obj)
default:
- unreachable()
+ panic("unreachable")
}
}
for x, info := range check.untyped {
if debug && isTyped(info.typ) {
check.dump("%v: %s (type %s) is typed", atPos(x), x, info.typ)
- unreachable()
+ panic("unreachable")
}
check.recordTypeAndValue(x, info.mode, info.typ, info.val)
}
case *syntax.ParenExpr:
f = p.X
default:
- unreachable()
+ panic("unreachable")
}
}
}
case Uint64:
return 0 <= x
default:
- unreachable()
+ panic("unreachable")
}
}
// x does not fit into int64
case UntypedFloat:
return true
default:
- unreachable()
+ panic("unreachable")
}
case isComplex(typ):
case UntypedComplex:
return true
default:
- unreachable()
+ panic("unreachable")
}
case isString(typ):
}
default:
- unreachable()
+ panic("unreachable")
}
assert(obj.Type() != nil)
return
d := check.objMap[obj]
if d == nil {
check.dump("%v: %s should have been declared", obj.Pos(), obj)
- unreachable()
+ panic("unreachable")
}
// save/restore current environment and set up object environment
// functions may be recursive - no need to track dependencies
check.funcDecl(obj, d)
default:
- unreachable()
+ panic("unreachable")
}
}
isPkgObj := obj.Parent() == check.pkg.scope
if isPkgObj != inObjMap {
check.dump("%v: inconsistent object map for %s (isPkgObj = %v, inObjMap = %v)", obj.Pos(), obj, isPkgObj, inObjMap)
- unreachable()
+ panic("unreachable")
}
}
case *Func:
// ignored for now
default:
- unreachable()
+ panic("unreachable")
}
}
}
}
-func unreachable() {
- panic("unreachable")
-}
-
// An error_ represents a type-checking error.
// To report an error_, call Checker.report.
type error_ struct {
// upon assignment or use.
if debug {
check.dump("%v: found old type(%s): %s (new: %s)", atPos(x), x, old.typ, typ)
- unreachable()
+ panic("unreachable")
}
return
}
default:
- unreachable()
+ panic("unreachable")
}
// If the new type is not final and still untyped, just
}
default:
- unreachable()
+ panic("unreachable")
}
// comparison is ok
switch e := e.(type) {
case nil:
- unreachable()
+ panic("unreachable")
case *syntax.BadExpr:
goto Error // error was reported before
msg = "%s is not an expression"
code = NotAnExpr
default:
- unreachable()
+ panic("unreachable")
}
check.errorf(x, code, msg, x)
x.mode = invalid
return s.WordSize
}
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
a := s.Sizeof(T) // may be 0 or negative
// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
assert(!isTypeParam(T))
return s.WordSize * 2
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
return s.WordSize // catch-all
}
case field:
*cause = check.sprintf("(%s.%s is a field, not a method)", V, m.Name())
default:
- unreachable()
+ panic("unreachable")
}
}
case syntax.StringLit:
kind = UntypedString
default:
- unreachable()
+ panic("unreachable")
}
val := makeFromLiteral(lit, k)
// avoid a crash in case of nil type
default:
- unreachable()
+ panic("unreachable")
}
return false
func (check *Checker) isTerminating(s syntax.Stmt, label string) bool {
switch s := s.(type) {
default:
- unreachable()
+ panic("unreachable")
case *syntax.DeclStmt, *syntax.EmptyStmt, *syntax.SendStmt,
*syntax.AssignStmt, *syntax.CallStmt:
func hasBreak(s syntax.Stmt, label string, implicit bool) bool {
switch s := s.(type) {
default:
- unreachable()
+ panic("unreachable")
case *syntax.DeclStmt, *syntax.EmptyStmt, *syntax.ExprStmt,
*syntax.SendStmt, *syntax.AssignStmt, *syntax.CallStmt,
case MethodExpr:
k = "method expr "
default:
- unreachable()
+ panic("unreachable")
}
var buf bytes.Buffer
buf.WriteString(k)
case *TypeParam:
// The underlying type of a receiver base type cannot be a
// type parameter: "type T[P any] P" is not a valid declaration.
- unreachable()
+ panic("unreachable")
}
if cause != "" {
check.errorf(recv, InvalidRecv, "invalid receiver type %s (%s)", rtyp, cause)
return s.WordSize
}
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
a := s.Sizeof(T) // may be 0 or negative
// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
assert(!isTypeParam(T))
return s.WordSize * 2
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
return s.WordSize // catch-all
}
case statement:
return
default:
- unreachable()
+ panic("unreachable")
}
check.errorf(&x, code, "%s %s %s", keyword, msg, &x)
}
return subst.smap.lookup(t)
default:
- unreachable()
+ panic("unreachable")
}
return typ
x.mode = nilvalue
default:
- unreachable()
+ panic("unreachable")
}
x.typ = typ
case *Builtin:
obj.pkg = Unsafe
default:
- unreachable()
+ panic("unreachable")
}
}
if scope.Insert(obj) != nil {
// trace is only available in test mode - no need to record signature
default:
- unreachable()
+ panic("unreachable")
}
assert(x.mode != invalid)
case *Interface:
return isTypeParam(t)
case *Named, *Union:
- unreachable()
+ panic("unreachable")
}
return false
}
case _Complex:
code = InvalidComplex
default:
- unreachable()
+ panic("unreachable")
}
check.softErrorf(x, code, "%s not supported as argument to %s for go1.18 (see go.dev/issue/50937)", x, predeclaredFuncs[id].name)
x.id = exp.id
default:
check.dump("%v: unexpected object %v", e.Sel.Pos(), exp)
- unreachable()
+ panic("unreachable")
}
x.expr = e
return
check.addDeclDep(obj)
default:
- unreachable()
+ panic("unreachable")
}
}
for x, info := range check.untyped {
if debug && isTyped(info.typ) {
check.dump("%v: %s (type %s) is typed", x.Pos(), x, info.typ)
- unreachable()
+ panic("unreachable")
}
check.recordTypeAndValue(x, info.mode, info.typ, info.val)
}
case *ast.ParenExpr:
f = p.X
default:
- unreachable()
+ panic("unreachable")
}
}
}
case Uint64:
return 0 <= x
default:
- unreachable()
+ panic("unreachable")
}
}
// x does not fit into int64
case UntypedFloat:
return true
default:
- unreachable()
+ panic("unreachable")
}
case isComplex(typ):
case UntypedComplex:
return true
default:
- unreachable()
+ panic("unreachable")
}
case isString(typ):
}
default:
- unreachable()
+ panic("unreachable")
}
assert(obj.Type() != nil)
return
d := check.objMap[obj]
if d == nil {
check.dump("%v: %s should have been declared", obj.Pos(), obj)
- unreachable()
+ panic("unreachable")
}
// save/restore current environment and set up object environment
// functions may be recursive - no need to track dependencies
check.funcDecl(obj, d)
default:
- unreachable()
+ panic("unreachable")
}
}
isPkgObj := obj.Parent() == check.pkg.scope
if isPkgObj != inObjMap {
check.dump("%v: inconsistent object map for %s (isPkgObj = %v, inObjMap = %v)", obj.Pos(), obj, isPkgObj, inObjMap)
- unreachable()
+ panic("unreachable")
}
}
case *Func:
// ignored for now
default:
- unreachable()
+ panic("unreachable")
}
}
}
}
-func unreachable() {
- panic("unreachable")
-}
-
// An error_ represents a type-checking error.
// To report an error_, call Checker.report.
type error_ struct {
// upon assignment or use.
if debug {
check.dump("%v: found old type(%s): %s (new: %s)", x.Pos(), x, old.typ, typ)
- unreachable()
+ panic("unreachable")
}
return
}
default:
- unreachable()
+ panic("unreachable")
}
// If the new type is not final and still untyped, just
}
default:
- unreachable()
+ panic("unreachable")
}
// comparison is ok
msg = "%s is not an expression"
code = NotAnExpr
default:
- unreachable()
+ panic("unreachable")
}
check.errorf(x, code, msg, x)
x.mode = invalid
return s.WordSize
}
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
a := s.Sizeof(T) // may be 0 or negative
// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
assert(!isTypeParam(T))
return s.WordSize * 2
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
return s.WordSize // catch-all
}
case field:
*cause = check.sprintf("(%s.%s is a field, not a method)", V, m.Name())
default:
- unreachable()
+ panic("unreachable")
}
}
case token.STRING:
kind = UntypedString
default:
- unreachable()
+ panic("unreachable")
}
val := makeFromLiteral(lit, k)
// avoid a crash in case of nil type
default:
- unreachable()
+ panic("unreachable")
}
return false
func (check *Checker) isTerminating(s ast.Stmt, label string) bool {
switch s := s.(type) {
default:
- unreachable()
+ panic("unreachable")
case *ast.BadStmt, *ast.DeclStmt, *ast.EmptyStmt, *ast.SendStmt,
*ast.IncDecStmt, *ast.AssignStmt, *ast.GoStmt, *ast.DeferStmt,
func hasBreak(s ast.Stmt, label string, implicit bool) bool {
switch s := s.(type) {
default:
- unreachable()
+ panic("unreachable")
case *ast.BadStmt, *ast.DeclStmt, *ast.EmptyStmt, *ast.ExprStmt,
*ast.SendStmt, *ast.IncDecStmt, *ast.AssignStmt, *ast.GoStmt,
case MethodExpr:
k = "method expr "
default:
- unreachable()
+ panic("unreachable")
}
var buf bytes.Buffer
buf.WriteString(k)
case *TypeParam:
// The underlying type of a receiver base type cannot be a
// type parameter: "type T[P any] P" is not a valid declaration.
- unreachable()
+ panic("unreachable")
}
if cause != "" {
check.errorf(recv, InvalidRecv, "invalid receiver type %s (%s)", rtyp, cause)
return s.WordSize
}
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
a := s.Sizeof(T) // may be 0 or negative
// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
assert(!isTypeParam(T))
return s.WordSize * 2
case *TypeParam, *Union:
- unreachable()
+ panic("unreachable")
}
return s.WordSize // catch-all
}
case statement:
return
default:
- unreachable()
+ panic("unreachable")
}
check.errorf(&x, code, "%s %s %s", keyword, msg, &x)
}
return subst.smap.lookup(t)
default:
- unreachable()
+ panic("unreachable")
}
return typ
x.mode = value
default:
- unreachable()
+ panic("unreachable")
}
x.typ = typ
case *Builtin:
obj.pkg = Unsafe
default:
- unreachable()
+ panic("unreachable")
}
}
if scope.Insert(obj) != nil {