-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
bad-testReport tests in need of updates. When closed, the tests should be considered goodReport tests in need of updates. When closed, the tests should be considered good
Description
FAILED: dart2analyzer-none release_arm64 co19/LanguageFeatures/Patterns/type_inference_A26_t01
Expected: Pass
Actual: CompileTimeError
--- Command "dart2analyzer" (took 21ms):
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/type_inference_A26_t01.dart
unexpected analysis errors in type_inference_A26_t01.dart:
- Line 31, column 10: COMPILE_TIME_ERROR.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
The element type 'double' can't be assigned to the list type 'int'.
- Line 32, column 22: COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
'num Function(num)' doesn't conform to the bound 'int Function(int)' of the type parameter 'R'.
- Line 44, column 26: COMPILE_TIME_ERROR.MAP_VALUE_TYPE_NOT_ASSIGNABLE
The element type 'double' can't be assigned to the map value type 'int'.
- Line 45, column 22: COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
'num Function(num)' doesn't conform to the bound 'int Function(int)' of the type parameter 'R'.
main() {
num a = 0;
a as int;
a.isEven;
[a] = [3.14];
My understanding is that we are expected to use the promoted type as the context type, so [3.14]
becomes <int>[3.14]
.
As I can see, the specification says "The context type schema for a pattern ... Identifier: In an assignment context, the context type schema is the static type of the variable that p resolves to."
It does says later about type checking, but this is after type schema was used: "In an assignment context, the required type of p is the (unpromoted) static type of the variable that p resolves to." This makes [a] = <double>[3.14]
valid.
Metadata
Metadata
Assignees
Labels
bad-testReport tests in need of updates. When closed, the tests should be considered goodReport tests in need of updates. When closed, the tests should be considered good