-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attach generic type parameters to the declaring type #2619
Conversation
ab6e89c
to
3f312fb
Compare
3f312fb
to
8326037
Compare
compiler/src/model/json-spec.ts
Outdated
@@ -74,5 +74,6 @@ export default function buildJsonSpec (): Map<string, JsonSpec> { | |||
map.set(name, json[name]) | |||
} | |||
|
|||
return map | |||
// Ensure deterministic ordering | |||
return new Map([...map.entries()].sort()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maps in JS are iterated in the order of insertion. This map is created by enumerating the filesystem which causes the entries to be inserted in a different order on Linux and Windows.
aa4cc9f
to
d7c6b0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@Anaethelion @JoshMock @l-trotta make sure this doesn't break anything in your respective clients. It should not, as it only changes the namespace of generic parameters, not their names.
The rationale behind this change is that it ensures global uniqueness of generic parameter names, even if their scope is limited to the enclosing type definition, which can help when processing a global type graph.
d7c6b0c
to
a306fdc
Compare
Attach generic type parameters to the declaring type instead of the parent namespace.
This more precisely reflects the actual declaration hierarchy and allows type parameters to be uniquely identified by their FQNs.
The following definition:
caused a type parameter with the FQN
some.namespace.T
to get emitted.The same type parameter is now emitted as
some.namespace.A.T
instead.