Skip to content

Improve static array initializer checks#14513

Open
ntrel wants to merge 3 commits intodlang:masterfrom
ntrel:sarr-init
Open

Improve static array initializer checks#14513
ntrel wants to merge 3 commits intodlang:masterfrom
ntrel:sarr-init

Conversation

@ntrel
Copy link
Contributor

@ntrel ntrel commented Oct 3, 2022

Disallow Deprecate null literal runtime SA initializer (except as an element initializer when element type accepts null). Rationale in bug below.
Disallow init as runtime SA initializer when static array length > 0.
Allow init as initializer for global static array regardless of length.

Fix Issue 23381 - init as initializer of 0-sized static array

ntrel added 3 commits October 3, 2022 12:49
Disallow null literal runtime initializer (except as element).
Disallow `init` as initializer when static array length > 0.
Allow `init` as initializer for global static array regardless of length.
@RazvanN7
Copy link
Contributor

RazvanN7 commented Oct 6, 2022

This requires a changelog entry.

@ljmf00 ljmf00 added the Review:Needs Changelog A changelog entry needs to be added to /changelog label Oct 6, 2022
@RazvanN7
Copy link
Contributor

RazvanN7 commented Nov 1, 2022

@ntrel Could you please add a changelog entry?

@RazvanN7
Copy link
Contributor

Allow init as initializer for global static array regardless of length.

Why? I don't understand why this should be legal:

int[1] a3 = (int[]).init; // ok

(int[]).init is null. If int[1] a3 = null is disabled why allow this?

@RazvanN7
Copy link
Contributor

ping @ntrel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review:Needs Changelog A changelog entry needs to be added to /changelog Review:stalled stalled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments