diff options
| author | Robert Griesemer <gri@golang.org> | 2025-03-03 15:11:47 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-03-06 13:35:46 -0800 |
| commit | 8b7e376e71cbd23a0644ff50cc4e75ce47cd9723 (patch) | |
| tree | bea412f5fd7813355c1b0504f7f4b1bc0b5e98d2 /src/internal | |
| parent | f55bb135d28bc95131a8c987d50350e5c6d7f633 (diff) | |
| download | go-8b7e376e71cbd23a0644ff50cc4e75ce47cd9723.tar.xz | |
go/types, types2: factor out single commonUnder function
Combine commonUnder and commonUnderOrChan:
- Provide an optional cond(ition) function argument to commonUnder
to establish additional type set conditions.
- Instead of a *Checker and *string argument for error reporting,
return an error cause that is only allocated in the presence of
an error.
- Streamline some error messages.
Replace all calls to coreType with calls to commonUnder.
Change-Id: I81ac86d0d532cddc09164309acced61d90718b44
Reviewed-on: https://go-review.googlesource.com/c/go/+/654455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/internal')
| -rw-r--r-- | src/internal/types/testdata/fixedbugs/issue43671.go | 8 | ||||
| -rw-r--r-- | src/internal/types/testdata/fixedbugs/issue47115.go | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/internal/types/testdata/fixedbugs/issue43671.go b/src/internal/types/testdata/fixedbugs/issue43671.go index 19da7e0ccc..5b44682a7a 100644 --- a/src/internal/types/testdata/fixedbugs/issue43671.go +++ b/src/internal/types/testdata/fixedbugs/issue43671.go @@ -12,11 +12,11 @@ type C4 interface{ chan int | chan<- int } type C5[T any] interface{ ~chan T | <-chan T } func _[T any](ch T) { - <-ch // ERRORx `cannot receive from ch .*: type set contains no specific channel type` + <-ch // ERRORx `cannot receive from ch .*: no specific channel type` } func _[T C0](ch T) { - <-ch // ERRORx `cannot receive from ch .*: type set contains non-channel int` + <-ch // ERRORx `cannot receive from ch .*: non-channel int` } func _[T C1](ch T) { @@ -28,11 +28,11 @@ func _[T C2](ch T) { } func _[T C3](ch T) { - <-ch // ERRORx `cannot receive from ch .*: type set contains channels with different element types int and float32` + <-ch // ERRORx `cannot receive from ch .*: channels chan int and chan float32 have different element types` } func _[T C4](ch T) { - <-ch // ERRORx `cannot receive from ch .*: type set contains send-only channel chan<- int` + <-ch // ERRORx `cannot receive from ch .*: send-only channel chan<- int` } func _[T C5[X], X any](ch T, x X) { diff --git a/src/internal/types/testdata/fixedbugs/issue47115.go b/src/internal/types/testdata/fixedbugs/issue47115.go index 1de85b3791..58b668ce4f 100644 --- a/src/internal/types/testdata/fixedbugs/issue47115.go +++ b/src/internal/types/testdata/fixedbugs/issue47115.go @@ -12,11 +12,11 @@ type C4 interface{ chan int | chan<- int } type C5[T any] interface{ ~chan T | chan<- T } func _[T any](ch T) { - ch <- /* ERRORx `cannot send to ch .*: type set contains no specific channel type` */ 0 + ch <- /* ERRORx `cannot send to ch .*: no specific channel type` */ 0 } func _[T C0](ch T) { - ch <- /* ERRORx `cannot send to ch .*: type set contains non-channel int` */ 0 + ch <- /* ERRORx `cannot send to ch .*: non-channel int` */ 0 } func _[T C1](ch T) { @@ -24,11 +24,11 @@ func _[T C1](ch T) { } func _[T C2](ch T) { - ch <- /* ERRORx `cannot send to ch .*: type set contains receive-only channel <-chan int` */ 0 + ch <- /* ERRORx `cannot send to ch .*: receive-only channel <-chan int` */ 0 } func _[T C3](ch T) { - ch <- /* ERRORx `cannot send to ch .*: type set contains channels with different element types` */ 0 + ch <- /* ERRORx `cannot send to ch .*: channels chan int and chan float32 have different element types` */ 0 } func _[T C4](ch T) { |
