diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go index 2e7b6366816..7c14fcf0416 100644 --- a/src/cmd/compile/internal/noder/noder.go +++ b/src/cmd/compile/internal/noder/noder.go @@ -36,7 +36,7 @@ func LoadPackage(filenames []string) { mode := syntax.CheckBranches if supportsGenerics { - mode |= syntax.AllowGenerics | syntax.AllowTypeSets + mode |= syntax.AllowGenerics } // Limit the number of simultaneously open files. diff --git a/src/cmd/compile/internal/syntax/error_test.go b/src/cmd/compile/internal/syntax/error_test.go index 0ab3c20ce53..d87e8eaee32 100644 --- a/src/cmd/compile/internal/syntax/error_test.go +++ b/src/cmd/compile/internal/syntax/error_test.go @@ -130,7 +130,7 @@ func testSyntaxErrors(t *testing.T, filename string) { var mode Mode if strings.HasSuffix(filename, ".go2") { - mode = AllowGenerics | AllowTypeSets + mode = AllowGenerics } ParseFile(filename, func(err error) { e, ok := err.(Error) diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go index a669c547126..e78e77561df 100644 --- a/src/cmd/compile/internal/syntax/parser.go +++ b/src/cmd/compile/internal/syntax/parser.go @@ -1820,7 +1820,7 @@ func (p *parser) paramDeclOrNil(name *Name, follow token) *Field { } // type set notation is ok in type parameter lists - typeSetsOk := p.mode&AllowTypeSets != 0 && follow == _Rbrack + typeSetsOk := follow == _Rbrack pos := p.pos() if name != nil { diff --git a/src/cmd/compile/internal/syntax/parser_test.go b/src/cmd/compile/internal/syntax/parser_test.go index 29682012e5d..68f3c376c92 100644 --- a/src/cmd/compile/internal/syntax/parser_test.go +++ b/src/cmd/compile/internal/syntax/parser_test.go @@ -26,11 +26,11 @@ var ( ) func TestParse(t *testing.T) { - ParseFile(*src_, func(err error) { t.Error(err) }, nil, AllowGenerics|AllowTypeSets) + ParseFile(*src_, func(err error) { t.Error(err) }, nil, AllowGenerics) } func TestVerify(t *testing.T) { - ast, err := ParseFile(*src_, func(err error) { t.Error(err) }, nil, AllowGenerics|AllowTypeSets) + ast, err := ParseFile(*src_, func(err error) { t.Error(err) }, nil, AllowGenerics) if err != nil { return // error already reported } @@ -46,7 +46,7 @@ func TestParseGo2(t *testing.T) { for _, fi := range list { name := fi.Name() if !fi.IsDir() && !strings.HasPrefix(name, ".") { - ParseFile(filepath.Join(dir, name), func(err error) { t.Error(err) }, nil, AllowGenerics|AllowTypeSets) + ParseFile(filepath.Join(dir, name), func(err error) { t.Error(err) }, nil, AllowGenerics) } } } diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go index 9b5331b1488..604f1fc1ca7 100644 --- a/src/cmd/compile/internal/syntax/printer_test.go +++ b/src/cmd/compile/internal/syntax/printer_test.go @@ -72,7 +72,7 @@ var stringTests = []string{ "package p; func (*R[A, B, C]) _()", "package p; func (_ *R[A, B, C]) _()", - // type constraint literals with elided interfaces (only if AllowTypeSets is set) + // type constraint literals with elided interfaces "package p; func _[P ~int, Q int | string]() {}", "package p; func _[P struct{f int}, Q *P]() {}", @@ -94,7 +94,7 @@ var stringTests = []string{ func TestPrintString(t *testing.T) { for _, want := range stringTests { - ast, err := Parse(nil, strings.NewReader(want), nil, nil, AllowGenerics|AllowTypeSets) + ast, err := Parse(nil, strings.NewReader(want), nil, nil, AllowGenerics) if err != nil { t.Error(err) continue diff --git a/src/cmd/compile/internal/syntax/syntax.go b/src/cmd/compile/internal/syntax/syntax.go index 49ba87786ee..f3d4c09ed5e 100644 --- a/src/cmd/compile/internal/syntax/syntax.go +++ b/src/cmd/compile/internal/syntax/syntax.go @@ -17,7 +17,6 @@ type Mode uint const ( CheckBranches Mode = 1 << iota // check correct use of labels, break, continue, and goto statements AllowGenerics - AllowTypeSets // requires AllowGenerics; remove once #48424 is decided ) // Error describes a syntax error. Error implements the error interface. diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go index 5b2f09425bb..bc68e764071 100644 --- a/src/cmd/compile/internal/types2/check_test.go +++ b/src/cmd/compile/internal/types2/check_test.go @@ -100,7 +100,7 @@ func testFiles(t *testing.T, filenames []string, colDelta uint, manual bool) { var mode syntax.Mode if strings.HasSuffix(filenames[0], ".go2") { - mode |= syntax.AllowGenerics | syntax.AllowTypeSets + mode |= syntax.AllowGenerics } // parse files and collect parser errors files, errlist := parseFiles(t, filenames, mode)