Initial commit: Go 1.23 release state
This commit is contained in:
16
test/typeparam/recoverimp.dir/a.go
Normal file
16
test/typeparam/recoverimp.dir/a.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package a
|
||||
|
||||
import "fmt"
|
||||
|
||||
func F[T any](a T) {
|
||||
defer func() {
|
||||
if x := recover(); x != nil {
|
||||
fmt.Printf("panic: %v\n", x)
|
||||
}
|
||||
}()
|
||||
panic(a)
|
||||
}
|
||||
12
test/typeparam/recoverimp.dir/main.go
Normal file
12
test/typeparam/recoverimp.dir/main.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "./a"
|
||||
|
||||
func main() {
|
||||
a.F(5.3)
|
||||
a.F("hello")
|
||||
}
|
||||
Reference in New Issue
Block a user