aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
AgeCommit message (Collapse)Author
2021-08-26cmd/compile/internal/types2: implement TypeList.String (debugging support)Robert Griesemer
Change-Id: Iaa203def3dac94a7d5ff6120e89315c3d7977ee1 Reviewed-on: https://go-review.googlesource.com/c/go/+/345471 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-08-25cmd/compile: always accept 1.18 syntax but complain if not 1.18Robert Griesemer
This CL configures the parser to always accept 1.18 syntax (type parameters, type instantiations, interface elements), even when -lang is set to an earlier release. Instead, the type checker looks for 1.18 operations and complains if the language version is set to an earlier release. Doing these checks during type checking is necessary because it it is possible to write "generic" code using pre-1.18 syntax; for instance, an imported generic function may be implicitly instantiated (as in imported.Max(2, 3)), or an imported constraint interface may be embedded in an "ordinary" interface. Fixes #47818. Change-Id: I83ec302b3f4ba7196c0a4743c03670cfb901310d Reviewed-on: https://go-review.googlesource.com/c/go/+/344871 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-08-24cmd/compile/internal/types2: use a TypeList type to hold type argumentsRobert Griesemer
This is a port of CL 343933 from go/types with the necessary adjustments in the compiler. With this CL type parameters and type lists are now held in TParamList and TypeList data types which don't expose the internal representation. Change-Id: I6d60881b5db995dbc04ed3f4a96e8b5d41f83969 Reviewed-on: https://go-review.googlesource.com/c/go/+/344615 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dan Scales <danscales@google.com>
2021-08-24cmd/compile/internal/types2: use []*TypeParam rather than []*TypeName for ↵Robert Griesemer
type param lists This is a port of CL 343932 from go/types, with the necessary adjustments to the compiler. This change improves type safety slightly, avoids many internal type assertions, and simplifies some code paths. Change-Id: Ie9c4734814f49cd248927152d7b3264d3578428c Reviewed-on: https://go-review.googlesource.com/c/go/+/344614 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dan Scales <danscales@google.com>
2021-08-19cmd/compile/internal/types2: return an error from InstantiateRobert Findley
Change Instantiate to be a function (not a method) and return an error. Introduce an ArgumentError type to report information about which type argument led to an error during verification. This resolves a few concerns with the current API: - The Checker method set was previously just Files. It is somewhat odd to add an additional method for instantiation. Passing the checker as an argument seems cleaner. - pos, posList, and verify were bound together. In cases where no verification is required, the call site was somewhat cluttered. - Callers will likely want to access structured information about why type information is invalid, and also may not have access to position information. Returning an argument index solves both these problems; if callers want to associate errors with an argument position, they can do this via the resulting index. We may want to make the first argument an opaque environment rather than a Checker. Change-Id: I3bc56d205c13d832b538401a4c91d3917c041225 Reviewed-on: https://go-review.googlesource.com/c/go/+/342152 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-08-18cmd/compile/internal/types2: no need to validate substituted instancesRobert Findley
When substituting a type instance, we rely on the instance being expanded and do not call validType, so there is need to depend on subster.pos for error reporting or to use subst.check for creating the new Named type. Errors will be reported for the unsubstituted instance. This is a superficial change, but justifies some later simplification where we don't have access to pos or check. Change-Id: I1f3f12aa245d821512c6242ad829c940f20afae4 Reviewed-on: https://go-review.googlesource.com/c/go/+/342150 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-08-14cmd/compile/internal/types2: remove targs from substMapRobert Findley
Now that we always capture targs when constructing an instance, we no longer need to pass them via the substMap. This simplifies the code and resolves a TODO. Change-Id: I592dccaeb89c7cc31ac037d919137bb762820365 Reviewed-on: https://go-review.googlesource.com/c/go/+/341859 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-08-14cmd/compile/internal/types2: merge Instantiate and InstantiateLazyRob Findley
Instantiate and InstantiateLazy have the same signature; on first principles, if Instantiate should work for importers it should be possible to consolidate these APIs. This CL does this. In order to make it work, a typMap needs to be threaded through type expansion to prevent infinite recursion in the case that the Checker is nil. Notably, Named types now must be expanded before returning from Underlying(). This makes Underlying generally unsafe to call while type checking a package, so a helper function safeUnderlying is added to provide the previous behavior. This is probably overly conservative at most call sites, but cleanup is deferred to a later CL. Change-Id: I03cfb75bea0750862cd6eea4e3cdc875a7daa989 Reviewed-on: https://go-review.googlesource.com/c/go/+/341855 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-08-06[dev.typeparams] cmd/compile: change types2.Union API to accept a list of TermsRobert Griesemer
Instead of providing a list of tildes and types, use a list of Terms to create a Union, with suitable accessors. Define the (exported) notion of a Term representing a union term. This simplified various uses and also will be easier to extend should we want to add more information to a Term in the future. Change-Id: I52fd73938bfa11bac60adbf10580b6d0680df4f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/340250 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-08-05[dev.typeparams] cmd/compile/internal/types2: implement type sets with term ↵Robert Griesemer
lists This CL resolves several known issues and TODOs. - Represent type sets with term lists and using term list abstractions. - Represent Unions internally as a list of (syntactical) terms. Use term operations to print terms and detect overlapping union entries. - Compute type sets corresponding to unions lazily, on demand. - Adjust code throughout. - Adjusted error check in test/typeparam/mincheck.dir/main.go to make test pass. Change-Id: Ib36fb7e1d343c2b6aec51d304f0f7d1ad415f999 Reviewed-on: https://go-review.googlesource.com/c/go/+/338310 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-29[dev.typeparams] cmd/compile/internal/types2: use the TParams API consistentlyRobert Griesemer
This is a clean port of CL 336251. Change-Id: I08415c3e9b6cef33594e7d56c4115ddde8030381 Reviewed-on: https://go-review.googlesource.com/c/go/+/338193 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-29[dev.typeparams] cmd/compile: set type parameter indices when they are boundRobert Griesemer
This is a port of CL 336249 with adjustments due to slightly different handling of type parameter declaration in types2. The CL also contains adjustments to the compiler front-end. With this change it is not necessary to export type parameter indices. Filed issue #47451 so we don't forget. Change-Id: I2834f7be313fcb4763dff2a9058f1983ee6a81b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/338192 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-29[dev.typeparams] cmd/compile/internal/types2: use type terms to represent unionsRobert Griesemer
This is just an internal representation change for now. Change-Id: I7e0126e9b17850ec020c2a60db13582761557bea Reviewed-on: https://go-review.googlesource.com/c/go/+/338092 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-28[dev.typeparams] cmd/compile/internal/types2: merge instance and Named to ↵Rob Findley
eliminate sanitization This is a port of CL 335929 to types2. It differs significantly from that CL to handle lazy loading, which wasn't tested in go/types. Additionally, the *Checker field was moved out of instance and back onto Named. This way we can tell whether a Named type is uninstantiated simply by checking whether Named.instance is non-nil, which simplified the code considerably. Fixes #46151 Change-Id: I617263bcfaa768ac5442213cecad8d567c2749fc Reviewed-on: https://go-review.googlesource.com/c/go/+/336252 Trust: Robert Findley <rfindley@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-13[dev.typeparams] cmd/compile/internal/types2: move instantiation code to ↵Robert Griesemer
instantiate.go (cleanup) No code changes besides moving the two functions and updating a couple of file comments. Change-Id: I13a6a78b6e8c132c20c7f81a329f31d5edab0453 Reviewed-on: https://go-review.googlesource.com/c/go/+/333589 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-13[dev.typeparams] cmd/compile/internal/types2: replace types2.Instantiate ↵Robert Griesemer
with Checker.Instantiate Allow Checker.Instantiate to work with a nil *Checker receiver (for now). This opens the door to passing in a *Checker at all times. Also, added a verify flag to Instantiate, InstantiateLazy, and instance, to be able to control if constraint satisfaction should be checked or not. Removed types2.Instantiate. For #47103. Change-Id: Ie00ce41b3e50a0fc4341e013922e5f874276d282 Reviewed-on: https://go-review.googlesource.com/c/go/+/333569 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-07-09[dev.typeparams] cmd/compile/internal/types2: recursive substitution must ↵Robert Griesemer
terminate (bug fix) When types2.Instantiate is called externally, no *Checker is provided and substitution doesn't have access to Checker.typMap; and instantiation of recursive generic types leads to an infinite recursion in subst. There was a local subster.cache but it was only set and never used. Replaced subster.cache with subster.typMap, which is set to the global Checker.typMap if available, and set to a local map otherwise. This prevents such infinite recursions. Added a simple test. More generally, because we don't have a global type map for external instantiations, instantiating the same type twice, independently but with the same type arguments, will result in two different types. This is not correct. We need to provide some form of context for external instantiations (which means the importers). This is a separate but related issue which is not yet addressed (filed #47103). Change-Id: I541556c677db54f7396fd0c88c7467894dfcf2e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/333383 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-09[dev.typeparams] cmd/compile/internal/types2: use scope numbers to identify ↵Robert Griesemer
local types Rather than using a local types' position information, use the type name's scope numbers to uniquely identify the type from others with the same name. We use scope numbers rather than indices (with number-1 == index) to preserve the invariant that the zero value for a scope is a ready to use empty scope. Using scope numbers turned out to be fairly simple after all and provides a reasonably stable identification which will make debugging simpler. A scope number series may be a bit longer than a unique ID for each type name but local types should be reasonably rare. Also did a minor cleanup in universe.go to ensure Named.orig is set up correctly (there's still an open TODO but with a work-around). Change-Id: I73935fa9bd960809fd5c95fe8b8a535c313cfc8f Reviewed-on: https://go-review.googlesource.com/c/go/+/333192 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-07-07[dev.typeparams] cmd/compile: fix bug with types2.Instantiate with interface ↵Dan Scales
type param types2.subst has an assertion that check is non-nil, but which breaks Instantiate() with an interface type param (used when re-importing instatiated type to types2). But this check was added when Instantiate() was added, and things seem to work fine when the assertion is removed. Fixes test/typeparam/mdempsky/7.go. Change-Id: I4980f0b202a0b310a3c91a7a87f97576f54911de Reviewed-on: https://go-review.googlesource.com/c/go/+/333155 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com>
2021-06-30[dev.typeparams] cmd/compile/internal/types2: move embedding positions from ↵Robert Griesemer
Checker to Interface This change moves the position information to the place where it is actually used. It also simplifies getting rid of it after use. In the process, fixed a latent bug: Before this CL, embedded types were sorted, but the corresponding embedding positions were not. Removed the sorting altogether as it is not needed for type-checking. Change-Id: I48003f317196d814326424430336b6cb222fdee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/331514 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-30[dev.typeparams] cmd/compile/internal/types2: introduce type set abstraction ↵Robert Griesemer
for interfaces With this change, interfaces are "completed" on-demand, when needed, and the respective information (set of all methods, type constraints) is recorded in a new typeSet data structure. As a consequence, interfaces don't need to be explicitly completed anymore and (internal) uses of interfaces have become much simpler. This change also introduces a new field Interface.complete to indicate that all methods and embedded elements have been set up. This prevent the computation and recording (!) of a partial type set for erroneous programs (if we compute the partial type set and store it, subsequent type set accesses use the wrong type set which may lead to follow-on errors). Change-Id: I1ffc907f7d0fb93b3e987fe5ff9c6fa5cae00d7f Reviewed-on: https://go-review.googlesource.com/c/go/+/329309 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-16[dev.typeparams] cmd/compile/internal/types2: support local defined typesMatthew Dempsky
This CL changes types2's instance hashing logic to include position information for function-scope defined types as disambiguation. This isn't ideal, but it worked for getting nested.go passing. Updates #46592. Change-Id: Id83ba0001f44af69b81260306cc8b05e44fc4f09 Reviewed-on: https://go-review.googlesource.com/c/go/+/327170 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-04[dev.typeparams] cmd/compile: lazy import resolution for types2Matthew Dempsky
This CL adds three new functions to the types2 API to support lazy import resolution: 1. A new Scope.InsertLazy method to allow recording that Objects exist in a particular Scope (in particular, package scopes) without having to yet fully construct those objects. Instead, types2 will call the provided `resolve` function if/when the object is actually needed. 2. Similarly, a new NewTypeNameLazy function to create TypeName objects without yet instantiating their underlying Named instance. 3. Finally, an InstantiateLazy method, that allows creating type instances without requiring any of the types to be expanded right away. Importantly, this requires providing a types2.Checker argument to handle recursive types correctly. The APIs as-is are a bit clumsy (esp. NewTypeNameLazy), but seem to work well for cmd/compile's needs. In particular, they simplify some of the complexities of handling recursive type definitions within the importer. Also, the current prototype is a bit fragile. It uses sync.Once to manage concurrent lazy resolution, which is frustrating to debug in the presence of reentrancy issues. It also means the importer needs to deal with concurrency as well. These aren't issues for types2 though as cmd/compile only walks the type-checked AST sequentially. Finally, it looks like some of the details of lazy type names are similar to the lazy "instance" stuff used for generics, so maybe there's opportunity for unifying them under a more general (but still internal) lazy type mechanism. I had originally intended for this CL to also update the types2 importer, but (1) it doesn't have access to the types2.Checker instance needed to call InstantiateLazy, and (2) it creates a new TypeName/TypeParam at each use rather than reusing them, which evidently works with types2.Instantiate but not types2.(*Checker).instantiate (i.e., InstantiateLazy). I spent a while trying to fix these issues, but kept running into more subtle issues. Instead, I've included my WIP "unified IR" CL as a followup CL that demonstrates these Lazy methods (see noder/reader2.go). Updates #46449. Change-Id: I4d1e8e649f6325a11790d25fd90c39fa07c8d41d Reviewed-on: https://go-review.googlesource.com/c/go/+/323569 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-06-02[dev.typeparams] cmd/compile/internal/types2: eliminate need for unpack and ↵Robert Griesemer
asUnion functions Change-Id: Iaa75b091d52f44939330e5945305aea323ba58f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/323355 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-02[dev.typeparams] cmd/compile/internal/types2: clean up type set/union ↵Robert Griesemer
intersection - Eliminate the need for bottom type: This is now represented by an empty union (denoting the set of no types). - Clean up type set intersection and incorporate tilde information in intersection operation and satisfaction tests. - Minor cleanups along the way. - Note: The intersection algorithm does not always compute the largest possible intersection. To be addressed in a follow-up CL. Change-Id: I7fa19df5996da36a4d8f29300d30a0aa4d8a3e5c Reviewed-on: https://go-review.googlesource.com/c/go/+/323354 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-06-02[dev.typeparams] cmd/compile/internal/types2: replace Sum type with Union typeRobert Griesemer
- We still mostly ignore the tilde information. - More consistent naming: A Union term is the pair (type, tilde). Rename Union.terms to Union.types; the Union.types and Union.tilde slices make up the Union terms. - Replace Sum.is with Union.underIs: underIs iterates through all union terms and calls its argument function with the underlying type of the term (and thus can ignore the tilde information). This also eliminates the need to call under in the argument function. - Added Union.is for situations where we need to consider the tilde information for each Union term. Change-Id: I70fcf1813e072651dc0f61d52d5555642ee762fd Reviewed-on: https://go-review.googlesource.com/c/go/+/323274 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-05-24[dev.typeparams] cmd/compile/internal/types2: factor out constraint ↵Robert Griesemer
satisfaction check This is a simple move of a block of inlined code into a function to make instantiation more manageable and easier to understand. There is no change in functionality or behavior. Change-Id: I46e7a9ea03527731e1f0219b3402eb03949627c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/322070 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-05-24[dev.typeparams] cmd/compile/internal/types2: accept embedded interface elementsRobert Griesemer
Accept embedded interface elements of the form ~T or A|B and treat them like type lists: for now the elements of a union cannot be interfaces. Also, translate existing style "type"- lists in interfaces into interface elements: "type a, b, c" becomes a union element "~a|~b|~c" which in turn is handled internally like a type list. For now, "~" is still ignored and type lists are mapped to Sum types as before, thus ensuring that all existing tests work as before (with some minor adjustments). Introduced a new Union type to represent union elements. For now they don't make it past interface completion where they are represented as a Sum type. Thus, except for printing (and the respective tests) and substitution for interfaces, the various type switches ignore Union types. In a next step, we'll replace Sum types with union types and then consider the ~ functionality as well. Because union elements are no different from embedded interfaces we don't need a separate Interface.types field anymore. Removed. For #45346. Change-Id: I98ac3286aea9d706e98aee80241d4712ed99af08 Reviewed-on: https://go-review.googlesource.com/c/go/+/321689 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-05-05cmd/compile/internal/types2: implement types2.InstantiateRobert Griesemer
Instantiation support for imports. This is experimental but it also doesn't affect Go 1.17 as this code is not executed unless we enable generics (in the parser). Change-Id: If2da09ac3a557ec6a180707a53f75f3ce354f3e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/314773 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
2021-04-14cmd/compile/internal/types2: add Named.SetTParams and Named.Orig methodsRobert Griesemer
Named.SetTParams sets the type parameters for a named type. Named.Orig returns the original generic type an instantiated type is derived from. Added a new field orig for that purpose and renamed the already existing orig field to fromRHS. Finally, updated various comments. Change-Id: Ic9d173e42740422d195713d8bdc62a54dc8c5f54 Reviewed-on: https://go-review.googlesource.com/c/go/+/309832 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18[dev.typeparams] cmd/compile/internal/types2: remove Type.Under method in ↵Robert Griesemer
favor of function This removes the need for the aType embedded type and brings the types2.Type API in sync with the go/types.Type API. For reasons not fully understood yet, introducing the new under function causes a very long initialization cycle error, which doesn't exist in go/types. For now, circumvent the problem through a helper function variable. This CL also eliminates superflous (former) Under() method calls inside optype calls (optype takes care of this). Plus some minor misc. cleanups and comment adjustments. Change-Id: I86e13ccf6f0b34d7496240ace61a1c84856b6033 Reviewed-on: https://go-review.googlesource.com/c/go/+/293470 Reviewed-by: Robert Findley <rfindley@google.com> Trust: Robert Griesemer <gri@golang.org>
2021-02-18[dev.typeparams] cmd/compile/internal/types2: replace Named, TypeParam ↵Robert Griesemer
methods with functions This removes two more converter methods in favor of functions. This further reduces the API surface of types2.Type and matches the approach taken in go/types. Change-Id: I3cdd54c5e0d1e7664a69f3697fc081a66315b969 Reviewed-on: https://go-review.googlesource.com/c/go/+/293292 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-11[dev.typeparams] cmd/compile/internal/types2: bring over subst.go changes ↵Robert Griesemer
from go/types This CL make this code match closely with the go/types version (see https://golang.org/cl/276253). Change-Id: I2b7841309fdbda7e2c9533768bd98317729b13b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/276814 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-01[dev.typeparams] cmd/compile/internal/types2: remove support for type ↵Robert Griesemer
parameter pointer designation An earlier version of the draft design supported pointer designation for type parameters. Remove related code since we don't need it anymore. Change-Id: I0d9e8c5f02a9a6745ff7ee15b8267a99ab1529e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/273327 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-10-21[dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of ↵Robert Griesemer
types2 and importer This is a copy of the importer and types2 (unreviewed) prototype version excluding the testdata directory containing tests (see below). Each file is marked with the comment // UNREVIEWED on the first line. The plan is to check in this code wholesale (it runs and passes all tests) and then review the code file-by-file via subsequent CLs and remove the "// UNREVIEWED" comments as we review the files. Since most tests are unchanged from the original go/types, the next CL will commit those tests as they don't need to be reviewed again. (Eventually we may want to factor them out and share them from a single place, e.g. the test directory.) The existing file fmtmap_test.go was updated. Change-Id: I9bd0ad1a7e7188b501423483a44d18e623c0fe71 Reviewed-on: https://go-review.googlesource.com/c/go/+/263624 Trust: Robert Griesemer <gri@golang.org> Trust: Keith Randall <khr@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>