mirror of
https://github.com/golang/go
synced 2024-11-23 07:30:05 -07:00
cmd/compile: add support for alternative comparable semantics
Add the experimental compiler flag -altcomparable. If set, the compiler uses alternative comparable semantics: any ordinary (non-type parameter) interface implements the comparable constraint. This permits experimenting with this alternative semantics akin to what is proposed in #52509. For #52509. Change-Id: I64192eee6f2a550eeb50de011079f2f0b994cf94 Reviewed-on: https://go-review.googlesource.com/c/go/+/444636 Run-TryBot: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
2dcc9acbd2
commit
b95ea201d5
@ -123,6 +123,7 @@ type CmdFlags struct {
|
||||
TraceProfile string "help:\"write an execution trace to `file`\""
|
||||
TrimPath string "help:\"remove `prefix` from recorded source file paths\""
|
||||
WB bool "help:\"enable write barrier\"" // TODO: remove
|
||||
AltComparable bool "help:\"enable alternative comparable semantics\"" // experiment - remove eventually
|
||||
|
||||
// Configuration derived from flags; not a flag itself.
|
||||
Cfg struct {
|
||||
|
@ -57,6 +57,7 @@ func checkFiles(noders []*noder) (posMap, *types2.Package, *types2.Info) {
|
||||
},
|
||||
Importer: &importer,
|
||||
Sizes: &gcSizes{},
|
||||
AltComparableSemantics: base.Flag.AltComparable, // experiment - remove eventually
|
||||
}
|
||||
info := &types2.Info{
|
||||
StoreTypesInSyntax: true,
|
||||
|
Loading…
Reference in New Issue
Block a user