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

Switch expression causes crash when merging multiple cases #52099

Closed
kenzieschmoll opened this issue Apr 19, 2023 · 0 comments
Closed

Switch expression causes crash when merging multiple cases #52099

kenzieschmoll opened this issue Apr 19, 2023 · 0 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@kenzieschmoll
Copy link
Contributor

Original discussion on this PR: flutter/devtools#5671

Even though the analyzer does not report any errors, this code does not build:

    final SourceLocation? sourceLocation = switch (object) {
      FieldRef(:final location) ||
      FuncRef(:final location) ||
      ClassRef(:final location) =>
        location,
      _ => null,
    };

FieldRef.location, FuncRef.location, and ClassRef.location all have a type of SourceLocation?, but the following build error occurs:

lib/src/screens/debugger/program_explorer_model.dart:349:23: Error: Variable pattern 'location' doesn't have the same type or finality in all cases.
      FieldRef(:final location) ||
                      ^^^^^^^^

CC @scheglov

@scheglov scheglov added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.
Projects
None yet
Development

No branches or pull requests

3 participants