Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Strong mode fixes #61

Merged
merged 5 commits into from
Sep 5, 2017
Merged

Strong mode fixes #61

merged 5 commits into from
Sep 5, 2017

Conversation

leafpetersen
Copy link
Contributor

Sorry for the second PR in a row. This is part of the continuing effort to eliminate fuzzy arrows: dart-lang/sdk#29630 .

This PR isn't required for the effort, but it is intended to make the API friendlier to typed code, so that fewer changes are required in user code. I noticed when working on other code that calls to predicate cause frequent error messages about fuzzy arrows. The only two API facing changes are to predicate and pairWiseCompare. In both cases, I am proposing to make those functions generic, so that their function argument can be typed precisely. This is so that code that looks like:

predicate((List<int> x) => x[0] = 1);

will be strong mode clean, instead of having to be written as:

predicate((_x) {List<int> x = _x; return x[0] == 1;});

or made fully dynamic.

I'm not sure whether this is considered a breaking change in the API or not - I believe that all existing non-strong mode code should be unaffected. Strong mode code that uses --no-implicit-dynamic could potentially get new errors.

In passing, I noticed a fair bit of internal code which is more dynamic than it needed to be (and hence which will be slow on DDC). I made a number of passing changes to enable promotion to kick in so that the code is more statically typed. All of these changes are intended to be semantics preserving.

@leafpetersen
Copy link
Contributor Author

PTAL.

@kevmoo kevmoo merged commit 3625f13 into master Sep 5, 2017
@kevmoo kevmoo deleted the strong_mode_fixes branch September 5, 2017 21:41
@kevmoo
Copy link
Contributor

kevmoo commented Sep 5, 2017

@leafpetersen I'll publish 😄

@leafpetersen
Copy link
Contributor Author

Thanks!

mosuem pushed a commit to dart-lang/test that referenced this pull request Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants