Skip to content

co19/LanguageFeatures/Patterns/variable_A01_t01 #1699

@scheglov

Description

@scheglov
FAILED: dart2analyzer-none release_arm64 co19/LanguageFeatures/Patterns/variable_A01_t01
Expected: Pass
Actual: CompileTimeError

--- Command "dart2analyzer" (took 06.000360s):
DART_CONFIGURATION=ReleaseARM64 sdk/bin/dart --packages=.dart_tool/package_config.json pkg/analyzer_cli/bin/analyzer.dart --use-analysis-driver-memory-byte-store --dart-sdk=/Users/scheglov/Source/Dart/sdk.git/sdk/sdk -Dtest_runner.configuration=custom-configuration-1 --enable-experiment=patterns,records --ignore-unrecognized-flags --packages=/Users/scheglov/Source/Dart/sdk.git/sdk/.dart_tool/package_config.json --format=json /Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/LanguageFeatures/Patterns/variable_A01_t01.dart

unexpected analysis errors in variable_A01_t01.dart:
- Line 52, column 26: COMPILE_TIME_ERROR.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
  The element type 'double' can't be assigned to the list type 'int'.

- Line 56, column 23: COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
  'double Function(double)' doesn't conform to the bound 'int Function(int)' of the type parameter 'R'.

--- Re-run this test:
python3 tools/test.py -m release -c dart2analyzer -a arm64 co19/LanguageFeatures/Patterns/variable_A01_t01

Code

  var [int a2, b2] = [1, 3.14];

Here b2 does not specify the type, so does not participate in computing the required type of [int a2, b2]. The resulting required type is List<int> as if we wrote <int>[a2, b2]. So, the context type of [1, 3.14] is also List<int>, and 3.14 is not valid there.

image

Metadata

Metadata

Assignees

Labels

bad-testReport tests in need of updates. When closed, the tests should be considered good

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions