Skip to content

analyzer: move strictCasts bool field out of TypeSystemImpl #53873

Closed
@srawlins

Description

@srawlins

TypeSystemImpl was a convenient place to drop in the value of whether "strict casts" has been enabled in an analysis options file, but the treatment of those files is changing (an analysis options file will not be sufficient conditions to create an analysis context), so I think that field needs to move out of TypeSystemImpl. How is it used?

  • A few error checkers query if (typeSystem.strictCasts) .... I think these queries can instead poke at the analysis options file which pertains to the library being analyzed.
  • Inside TypeSystemImpl, the field is used in exactly one position: the isAssignableTo function, in order to disable all downcasts. We could instead make bool strictCasts a parameter on the function. But this function is referenced 59 times (at least?) in the Dart SDK, and they should probably all pass the correct value of strictCasts as per some library's analysis options file.

CC @scheglov @keertip @bwilkerson @pq .

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failuresanalyzer-analysis-optionsanalyzer-apiIssues that impact the public API of the analyzer packagedevexp-warningIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions