Skip to content

CFE should report a compile-time error when using ":" as the default value separator in 3.0 #51576

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

Closed
munificent opened this issue Feb 28, 2023 · 5 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Milestone

Comments

@munificent
Copy link
Member

For Dart 3.0, we are removing support for the long-deprecated ancient : default separator syntax:

foo({int x: 3}) {}

Analyzer has already implemented this and reports an error on the above code. The CFE should too.

@munificent munificent added the legacy-area-front-end Legacy: Use area-dart-model instead. label Feb 28, 2023
@johnniwinther johnniwinther self-assigned this Feb 28, 2023
@johnniwinther
Copy link
Member

Is this only libraries with a language version >= 3.0 ?

@munificent
Copy link
Member Author

I don't know actually. I haven't been driving this change and the main issue isn't clear. If it were up to me, I would still allow : in libraries whose language version is <3.0. @bwilkerson, how does the analyzer handle this? @lrhn or @mit-mit, do you have a preference?

@bwilkerson
Copy link
Member

In code prior to 3.0 analyzer issues a warning that the syntax is going away. In 3.0 and later it issues an error saying that it's no longer allowed. Specifically, the 3.0 messages (problem and correction) read:

Using a colon as a separator before a default value is no longer supported.

Try replacing the colon with an equal sign.

@lrhn
Copy link
Member

lrhn commented Feb 28, 2023

Definitely allow it in pre-3.0 libraries. It's a versioned language change, which is why it's not considered a big bad breaking change.

@munificent
Copy link
Member Author

Confirming what @lrhn says, we discussed this in the language meeting today and agreed it should be a versioned change. It's an error to use : as a default value separator in a 3.0 library. It is not an error to use : as a default value separator in a <3.0 library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

5 participants