Skip to content
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

Meta issue for Dart 1.5 generic methods, non-strong mode. #27501

Closed
9 tasks done
leafpetersen opened this issue Oct 5, 2016 · 21 comments
Closed
9 tasks done

Meta issue for Dart 1.5 generic methods, non-strong mode. #27501

leafpetersen opened this issue Oct 5, 2016 · 21 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Milestone

Comments

@leafpetersen
Copy link
Member

leafpetersen commented Oct 5, 2016

This is a tracking bug for generic methods in non-strong mode Dart 1.5 .

@leafpetersen leafpetersen added this to the 1.50 milestone Oct 5, 2016
@leafpetersen leafpetersen self-assigned this Oct 5, 2016
@leafpetersen leafpetersen added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Oct 5, 2016
@leafpetersen
Copy link
Member Author

@leafpetersen
Copy link
Member Author

@eernstg My understanding is that the dart2js implementation is up to date, is that correct? If not I'll file an implementation bug.

@eernstg
Copy link
Member

eernstg commented Oct 21, 2016

The dart2js implementation currently needs the '--generic-method-syntax' option in order to enable this feature, and it emits a warning (reportWarningMessage). If the latter conflicts with "warning free" code requirements then I'd need to change that to reportHintMessage.

@floitschG floitschG assigned eernstg and unassigned leafpetersen Nov 2, 2016
@leafpetersen
Copy link
Member Author

I believe that support is now at a point where we can start the process of moving this out from under a flag in all implementations and testing it out, probably starting with the SDK.

@bwilkerson
Copy link
Member

Is there an order in which the flags should be removed, or should I go ahead and remove the flag from analyzer?

@leafpetersen
Copy link
Member Author

@eernstg is managing the flag removal, but I believe the plan is to do this as soon as possible. From my perspective, the only constraint is that all of the flags should be removed atomically with respect to the next roll into google3 (that is, I don't think we should do a roll in which the analyzer supports them without a flag but the VM or dart2js doesn't).

I'd also like to see us do this soon, so we can start converting over the comment syntax and get some more confidence that there aren't bugs.

@eernstg
Copy link
Member

eernstg commented Nov 9, 2016

We will now get ready to enable this feature in all tools: Every tool team can go ahead and create a CL to enable syntax-only generic methods by default, but keep that CL un-landed for now. We will land this feature at the same time, and put a bullet into CHANGELOG.md about it.

Here's some information about the considerations behind this approach:

It is in fact a breaking change to enable syntax-only generic methods by default: for instance, the argument list in foo(a < b, c > (d)) used to contain two relational expressions, but with this feature it is one invocation of a generic function a with type arguments b, c and value argument d. We expect the number of libraries affected by this problem to be extremely low, but we should still make sure that we introduce this feature in a way that keeps the disruption at the lowest possible level.

It should be noted that there is no way the introduction of this feature could silently change the meaning of a working program: If foo(a < b, c > (d)) is working code before the change then c cannot possibly be a type literal (because Type does not support operator >, and type literals are resolved statically so this would be a static type warning in plain Dart, and an error in strong mode). Even if it is plain Dart and the warning is ignored, it is a runtime error to evaluate c > (d) when c is a type literal, no matter whether d can be evaluated or not. The same line of reasoning is applicable if c is replaced by c<..>, which looks like a class with type arguments after the change, and would have been some relational expressions ending in .. >> (d) (using the shift-right operator) before the change (and >>> won't parse, so it ends here).

The disruption amounts to programs that used to work but now have compile-time errors, or warnings and run-time errors. The diagnostic messages might not be very helpful (because the old code was never intended to call generic methods), so we will need to make sure that the developers will have a chance to discover what is going on, if it hits them. Hence the entry in CHANGELOG.md.

@crelier
Copy link
Contributor

crelier commented Nov 9, 2016

VM changelist: https://codereview.chromium.org/2486943003

@bwilkerson
Copy link
Member

Analyzer CL: https://codereview.chromium.org/2488043002/

@leafpetersen
Copy link
Member Author

status: Implementation is almost done, I believe there were some issues with the presubmit. @eernstg can you update?

@eernstg
Copy link
Member

eernstg commented Nov 15, 2016

Analyzer being debugged (some issues arose in the global pre-submit in google3).

@eernstg
Copy link
Member

eernstg commented Nov 17, 2016

One update in google3 requested, and then we should have a clean global pre-submit run with the analyzer.

@eernstg
Copy link
Member

eernstg commented Nov 21, 2016

Current status:

The VM and dart2js CLs went through the global pre-submit with 14 new errors, all of which were unlikely to be caused by this change (for instance, almost all of them had a "recently flaky" flag, and the remaining ones were network errors like 'recycling port still in use', and similar things). Consequently, last week I asked to get these CLs (2486943003 and 2476423005) landed, and that should happen within days (2476423005 was landed last week and reverted because of some status file issues, an update is expected to land tomorrow; I just sent a reminder about landing 2486943003).

The analyzer was a bit more complex to handle; the global pre-submit had 144 new test failures; they turned out to be concerned with generic tear-offs (someFunction<SomeType>) in comment syntax; the google3 code was adjusted (CL 139451169), so google3 is ready now.

One issue remains: The analyzer performs a large number of checks on generic methods, and we haven't clarified the relationship between the checks performed by the analyzer and the checks specified in the informal spec of this feature. Apparently, it is not simple to make the analyzer perform just those (few) checks, and it is not simple to make the analyzer ignore the comment syntax when in standard (non-strong) mode.

@bwilkerson
Copy link
Member

It appears that I haven't been very clear in our conversations, for which I apologize.

... it is not simple to make the analyzer perform just those (few) checks ...

That's not accurate. If we know of an error that is being produced when it shouldn't be it's fairly trivial to find where that's happening and either stop reporting it or report a hint instead of an error. Hence my question about tests, because the tests will tell us when we're incorrectly generating an error so that we can fix it.

What isn't trivial is to ensure that we have caught all of the places where an existing error is being generated when it shouldn't be. Basically we'll only be as complete as the test suite used to find such places.

... it is not simple to make the analyzer ignore the comment syntax when in standard (non-strong) mode ...

As far as I know, analyzer does ignore the comment syntax when in standard mode. (I think we were mis-communicating because we were discussing both a general principle and a specific case at the same time.) If you have evidence to the contrary, please let me know.

@crelier
Copy link
Contributor

crelier commented Nov 21, 2016

I just landed the flag change in the VM.

eernstg added a commit that referenced this issue Nov 22, 2016
Fixed some status entries since the first land-revert of this CL.

This addresses #27501.

[email protected]

Review URL: https://codereview.chromium.org/2520293002 .
@eernstg
Copy link
Member

eernstg commented Nov 22, 2016

The language group discussed the situation and agreed that it is OK to proceed to land the analyzer CL and then handle the error-to-hint adjustments afterwards.

@mit-mit
Copy link
Member

mit-mit commented Nov 23, 2016

The language group discussed the situation and agreed that it is OK to proceed to land the analyzer CL and then handle the error-to-hint adjustments afterwards.

@bwilkerson can we go ahead and land the cl so that we can get this complete in 1.21?

@mit-mit
Copy link
Member

mit-mit commented Nov 23, 2016

@munificent I see in dart-lang/dart_style#556 that formatter support landed in that repo. Do we need something to bring that over to 1.21 in the SDK?

@eernstg
Copy link
Member

eernstg commented Nov 23, 2016

FYI: The analyzer CL was already landed yesterday (and a comment on this action was added to #27641 when it was closed).

@munificent
Copy link
Member

Do we need something to bring that over to 1.21 in the SDK?

I just published a new version of dart_style with that fix (and the other half of generic method syntax that I overlooked—parameters), and pulled that version into the master branch of the SDK's DEPS file. As far as I know, we should be good after that.

@eernstg
Copy link
Member

eernstg commented Nov 30, 2016

Cool! Closing.

@eernstg eernstg closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Projects
None yet
Development

No branches or pull requests

6 participants