Skip to content

Add spec for strict-raw-types #521

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

Merged
merged 2 commits into from
Aug 19, 2019

Conversation

srawlins
Copy link
Member

Fixes #516

@@ -0,0 +1,125 @@
# Strict raw types static analysis option
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comments in the strict inference review, consider moving this to resources/type-system? Or alternatively add a resources/strict-checks/ directory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


```yaml
analyzer:
langauge:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be language

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

## Enabling strict raw types

To enable strict raw types, set the `strict-raw-types` option to `true`, under
the Analyzer's `language` section:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a command line option version of this flag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there isn't presently. I can't find the review comment, but I think @bwilkerson recommended just wiring an analysis option, because we're primarily dogfooding this internally, where it will exclusively be wired via an analysis options file.

I don't think there was an intention to never add a command-line flag, it was just simpler not to for now.

}
```

The devloper likely does not realize that the parameter `e` of the callback is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devloper => developer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Reporting strict raw types encourages developers to fill in omitted type
arguments, hopefully with something other than `dynamic`. In cases where the
only good type is `dynamic`, then including it as an explicit type argument
avoids the raw type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps: "avoids the raw type, and makes the dynamic behavior more explicit in the code."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. Done.

@srawlins srawlins merged commit 82d6929 into dart-lang:master Aug 19, 2019
@srawlins srawlins deleted the add-strict-raw-types branch August 19, 2019 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a strict-raw-types static inference mode.
3 participants