Skip to content

Erroneous error about an unexhaustive switch in dart2js only #51823

@jakemac53

Description

@jakemac53

Related to flutter/flutter#123242.

Building a dart2js app internally without that change results in the following error:

package:flutter/src/widgets/focus_traversal.dart:474:28:
Error: The type 'TraversalEdgeBehavior' is not exhaustively matched by the switch cases.
 - 'TraversalEdgeBehavior' is from 'package:flutter/src/widgets/focus_traversal.dart'.
      switch (nearestScope.traversalEdgeBehavior) {
                           ^
package:flutter/src/widgets/focus_traversal.dart:492:28:
Error: The type 'TraversalEdgeBehavior' is not exhaustively matched by the switch cases.
 - 'TraversalEdgeBehavior' is from 'package:flutter/src/widgets/focus_traversal.dart'.
      switch (nearestScope.traversalEdgeBehavior) {
                           ^
Error: Compilation failed.

This can be "fixed" by changing this line to pass an explicit false and changing this line to set an explicit true as well. Essentially, forcing the CFE to evaluate constants eagerly.

cc @sigmundch for triage, I am not sure if I should assign this to area-web or area-frontend

Metadata

Metadata

Assignees

Labels

legacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions