aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-07-11 13:06:54 -0700
committerDan Scales <danscales@google.com>2021-07-16 18:30:16 +0000
commited9e109dc9a3523100d19e6f259edccbd7dd3cba (patch)
tree9ed7285fe358785ca10c9fe929446dace7dba6fa /test
parent3d8453e00e3d0a6f23cec06bcad08cf740ec5940 (diff)
downloadgo-ed9e109dc9a3523100d19e6f259edccbd7dd3cba.tar.gz
go-ed9e109dc9a3523100d19e6f259edccbd7dd3cba.zip
[dev.typeparams] cmd/compile: fix small -G=3 issues for tests disabled in run.go
- set correct position for closure capture variable in (*irgen).use() (issue20250.go) Also, evaluate rhs, lhs in that order in assignment statements to match noder1 (affects ordering of closure variables). - make sure to set Assign flag properly in (*irgen).forStmt() for range variables which are map accesses (issue9691.go) - make sure CheckSize() is call on the base type for top-level types converted by (*irgen).typ() that are pointer types (issue20174.go and issue37837.go) - deal with parentheses properly in validation function (*irgen).validate() (issue17270.go) - avoid HasNil call on type TTYPEPARAM - types2 typechecker will have already checked validity of the typeparam having nil value (new test issue39755.go) Change-Id: Ie68004d964698aea047e19e7dcd79b297e9d47ca Reviewed-on: https://go-review.googlesource.com/c/go/+/334733 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test')
-rw-r--r--test/run.go7
-rw-r--r--test/typeparam/issue39755.go27
2 files changed, 28 insertions, 6 deletions
diff --git a/test/run.go b/test/run.go
index 82d49270f2..3ccf1046ce 100644
--- a/test/run.go
+++ b/test/run.go
@@ -2167,12 +2167,7 @@ var types2Failures32Bit = setOf(
)
var g3Failures = setOf(
- "writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault)
- "fixedbugs/issue17270.go", // ICE in irgen
- "fixedbugs/issue20174.go", // ICE due to width not calculated (probably irgen's fault)
- "fixedbugs/issue20250.go", // correct diagnostics, but different lines (probably irgen's fault)
- "fixedbugs/issue37837.go", // ICE due to width not calculated
- "fixedbugs/issue9691.go", // "cannot assign to int(.autotmp_4)" (probably irgen's fault)
+ "writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault)
"typeparam/nested.go", // -G=3 doesn't support function-local types with generics
diff --git a/test/typeparam/issue39755.go b/test/typeparam/issue39755.go
new file mode 100644
index 0000000000..13a575d16f
--- /dev/null
+++ b/test/typeparam/issue39755.go
@@ -0,0 +1,27 @@
+// compile -G=3
+
+// Copyright 2020 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.
+
+// copied from cmd/compile/internal/types2/testdata/fixedbugs/issue39755.go
+
+package p
+
+func _[T interface{~map[string]int}](x T) {
+ _ = x == nil
+}
+
+// simplified test case from issue
+
+type PathParamsConstraint interface {
+ ~map[string]string | ~[]struct{key, value string}
+}
+
+type PathParams[T PathParamsConstraint] struct {
+ t T
+}
+
+func (pp *PathParams[T]) IsNil() bool {
+ return pp.t == nil // this must succeed
+}