-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
support type annotations on global variables #43671
Merged
Merged
Commits on Jan 8, 2022
-
new types should go at end of struct
Configuration menu - View commit details
-
Copy full SHA for f819538 - Browse repository at this point
Copy the full SHA f819538View commit details -
support type annotations on global variables
This is an initial proposal for supporting typed globals based on #43455. The syntax for this is either `global x::T` or just doing `x::T = 1` in global scope. It is even supported to add these annotations to globals from inside functions. The type declaration will then be applied when the method is defined and inside the function body conversion to the specified type will happen automatically, similar to type annotations for local variables. This conversion will not be applied if the assignment is not done inside the same scope of the type annotation however. This could potentially be supported as well, but the problem is that this would mean any assignment to a global variable - typed or not - would need to go through a call to `convert` first, since lowering can't know if a given binding already has a type annotation. This probably wouldn't be a good thing for latency and sysimage size and would add an invalidation risk. It is allowed to refine a type annotation, but there will be a warning. Widening the type or changing it to any other type that is not a subtype of the previous one is an error, since that could cause cached compiled code to become invalid. replaces #43455 closes #964
Configuration menu - View commit details
-
Copy full SHA for ee478df - Browse repository at this point
Copy the full SHA ee478dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2846e34 - Browse repository at this point
Copy the full SHA 2846e34View commit details -
Configuration menu - View commit details
-
Copy full SHA for b6e4587 - Browse repository at this point
Copy the full SHA b6e4587View commit details -
Configuration menu - View commit details
-
Copy full SHA for a3e6c98 - Browse repository at this point
Copy the full SHA a3e6c98View commit details -
Configuration menu - View commit details
-
Copy full SHA for bc38f26 - Browse repository at this point
Copy the full SHA bc38f26View commit details -
Lowering split up `i = i - 1` using an additional SSA value here, which should be completely harmless, but broke this test.
Configuration menu - View commit details
-
Copy full SHA for 1791c3c - Browse repository at this point
Copy the full SHA 1791c3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c4161fd - Browse repository at this point
Copy the full SHA c4161fdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 28c8cba - Browse repository at this point
Copy the full SHA 28c8cbaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 646e2ab - Browse repository at this point
Copy the full SHA 646e2abView commit details
Commits on Jan 16, 2022
-
Configuration menu - View commit details
-
Copy full SHA for e0e0364 - Browse repository at this point
Copy the full SHA e0e0364View commit details -
Configuration menu - View commit details
-
Copy full SHA for b28d542 - Browse repository at this point
Copy the full SHA b28d542View commit details -
Configuration menu - View commit details
-
Copy full SHA for b208fbf - Browse repository at this point
Copy the full SHA b208fbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for d7e92f1 - Browse repository at this point
Copy the full SHA d7e92f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for ff22fc0 - Browse repository at this point
Copy the full SHA ff22fc0View commit details -
Configuration menu - View commit details
-
Copy full SHA for e93e694 - Browse repository at this point
Copy the full SHA e93e694View commit details
Commits on Jan 21, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 3656ddf - Browse repository at this point
Copy the full SHA 3656ddfView commit details
Commits on Jan 22, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 1d54432 - Browse repository at this point
Copy the full SHA 1d54432View commit details
Commits on Jan 23, 2022
-
Configuration menu - View commit details
-
Copy full SHA for ce66bbb - Browse repository at this point
Copy the full SHA ce66bbbView commit details -
Configuration menu - View commit details
-
Copy full SHA for f2d1b48 - Browse repository at this point
Copy the full SHA f2d1b48View commit details
Commits on Jan 24, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 931b7ba - Browse repository at this point
Copy the full SHA 931b7baView commit details -
Change lowering s.t. types are always frozen before functions writing to a global are defined. `get_binding_type` now errors if the binding is still uninitialized. Also make multiple type declarations in local scope a runtime error.
Configuration menu - View commit details
-
Copy full SHA for e04c6be - Browse repository at this point
Copy the full SHA e04c6beView commit details -
Configuration menu - View commit details
-
Copy full SHA for 346220a - Browse repository at this point
Copy the full SHA 346220aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8989e6e - Browse repository at this point
Copy the full SHA 8989e6eView commit details
Commits on Jan 25, 2022
-
Configuration menu - View commit details
-
Copy full SHA for de692a7 - Browse repository at this point
Copy the full SHA de692a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for b36f3e2 - Browse repository at this point
Copy the full SHA b36f3e2View commit details
Commits on Jan 26, 2022
-
Configuration menu - View commit details
-
Copy full SHA for edfadd3 - Browse repository at this point
Copy the full SHA edfadd3View commit details
Commits on Feb 4, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 38d1b06 - Browse repository at this point
Copy the full SHA 38d1b06View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1504a97 - Browse repository at this point
Copy the full SHA 1504a97View commit details -
Configuration menu - View commit details
-
Copy full SHA for 160ee63 - Browse repository at this point
Copy the full SHA 160ee63View commit details
Commits on Feb 7, 2022
-
Configuration menu - View commit details
-
Copy full SHA for a334a9b - Browse repository at this point
Copy the full SHA a334a9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for efdb986 - Browse repository at this point
Copy the full SHA efdb986View commit details
Commits on Feb 8, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 645f155 - Browse repository at this point
Copy the full SHA 645f155View commit details -
Configuration menu - View commit details
-
Copy full SHA for b442636 - Browse repository at this point
Copy the full SHA b442636View commit details -
Configuration menu - View commit details
-
Copy full SHA for 592c957 - Browse repository at this point
Copy the full SHA 592c957View commit details -
Configuration menu - View commit details
-
Copy full SHA for 59bc7c0 - Browse repository at this point
Copy the full SHA 59bc7c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 29afe48 - Browse repository at this point
Copy the full SHA 29afe48View commit details -
Configuration menu - View commit details
-
Copy full SHA for d265016 - Browse repository at this point
Copy the full SHA d265016View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2183d33 - Browse repository at this point
Copy the full SHA 2183d33View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.