This adds type checking to TypeAssertExpr. In order to allow for this, method types now have a receiver type in both reflect and native cases.
15 lines
179 B
Go
15 lines
179 B
Go
package main
|
|
|
|
import "strconv"
|
|
|
|
func main() {
|
|
var err error
|
|
_, err = strconv.Atoi("erwer")
|
|
if _, ok := err.(*strconv.NumError); ok {
|
|
println("here")
|
|
}
|
|
}
|
|
|
|
// Output:
|
|
// here
|