this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

all: remove redundant interface type assertions

These two are of the form:

type T interface { ... }
var v1 T
v2 := v1.(T)

That is, if v1 is already of interface type T,
then the type assertion `.(T)` is unnecessary.
Found via staticcheck's S1040.

Change-Id: Icd57e251121cb1f646106115ab5c9f9cb40768bb
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/536097
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>

+3 -9
+1 -1
internal/core/adt/eval.go
··· 1163 1163 v = &BasicType{K: n.kind} 1164 1164 1165 1165 case 1: 1166 - v = a[0].(Value) // remove cast 1166 + v = a[0] 1167 1167 1168 1168 default: 1169 1169 v = &Conjunction{Values: a}
+2 -8
pkg/internal/errors.go
··· 77 77 c.Err = b 78 78 return 79 79 } 80 - v, ok := arg.(adt.Value) 81 80 // TODO: make these permanent errors if the value did not originate from 82 81 // a reference. 83 - if !ok { 84 - c.errf(nil, 85 - "cannot use incomplete value %s as %s in argument %d to %s", 86 - arg, typ, i, c.Name()) 87 - } 88 82 if err != nil { 89 83 c.errf(err, 90 84 "cannot use %s (type %s) as %s in argument %d to %s", 91 - arg, v.Kind(), typ, i, c.Name()) 85 + arg, arg.Kind(), typ, i, c.Name()) 92 86 } else { 93 87 c.errf(err, 94 88 "cannot use %s (type %s) as %s in argument %d to %s", 95 - arg, v.Kind(), typ, i, c.Name()) 89 + arg, arg.Kind(), typ, i, c.Name()) 96 90 } 97 91 }