-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add ECMA augments regarding instance and type construction. #110343
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ This is a list of additions and edits to be made in ECMA-335 specifications. It | |
| - [Creating arrays using newobj](#creating-arrays-using-newobj) | ||
| - [API documentation](#api-documentation) | ||
| - [Debug Interchange Format](#debug-interchange-format) | ||
| - [Instance construction](#instance-construction) | ||
| - [Type initialization](#type-initialization) | ||
|
|
||
| ## Signatures | ||
|
|
||
|
|
@@ -1102,3 +1104,19 @@ The incorrect description of `System.Array.Initialize` API in section "II.13.2 I | |
| ## Debug Interchange Format | ||
|
|
||
| The Debug Interchange Format described in partition V is superseded by the [Portable PDB Format](PortablePdb-Metadata.md). | ||
|
|
||
| ## Instance construction | ||
|
|
||
| The following is added to the section "II.10.5.1 Instance constructor": | ||
|
|
||
| > Instance constructors shall not be executed multiple times for a single object instance. Explicit calls to constructors on object instances from user code are only permitted when calling instance constructors of the base type inside of instance constructors of the derived type. | ||
|
|
||
| ## Type initialization | ||
|
|
||
| The following is added to the section "II.10.5.3 Type initializer": | ||
|
|
||
| > Type initializers shall not be called explicitly from user code. Users intending to guarantee the type initializer has been executed shall use the `System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor` method. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This contradicts "A type initializer shall be executed exactly once for any given type, unless explicitly
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is changed with the next paragraph. |
||
|
|
||
| Section "II.10.5.3.1 Type initialization guarantees" is changed so that the guarantee number 3 now states the following: | ||
|
|
||
| > A type initializer shall be executed exactly once for any given type, unless the previous attempt resulted in a `System.TypeInitializationException` being thrown at the location that triggered it. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am not sure what this is trying to say.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not correct. If the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not know that, I feel like older versions of legacy Mono might've been non compliant with this cause I recall it being rerun in Unity. |
||
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.
This is not correct. Try this:
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.
Also, you may want to update the wording in the
callinstruction verification rules that have the same mistake: "The call instruction can also be used to call an object’s base class constructor, or to initialize a value type location by calling an appropriate constructor, both of which are treated as special cases by verification.".It may be sufficient to just fix the
callverification rules to be more precise instead of duplicating it here.