-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Closed
Copy link
Labels
language-nonfunction-type-aliasesIssues related to non-function type aliasesIssues related to non-function type aliaseslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.
Milestone
Description
Dart VM version: 2.9.0-17.0.dev (dev) (Thu Jun 18 10:22:39 2020 +0200) on "windows_x64"
The following source code example calls generic type alias constructor without type parameter specified:
class C<T> {}
typedef CAlias<T extends num> = C<T>;
main() {
CAlias ca1 = new CAlias();
print(ca1 is C<num>);
}Seems like dart should print true, however it throws a compile error instead.
Sample output is:
$> dart --enable-experiment=nonfunction-type-aliases test.dart
test.dart:5:20: Error: The constructor returns type 'C' that isn't of expected type 'C'.
- 'C' is from 'test.dart'.
Change the type of the object being constructed or the context in which it is used.
CAlias ca1 = new CAlias();
^
Metadata
Metadata
Assignees
Labels
language-nonfunction-type-aliasesIssues related to non-function type aliasesIssues related to non-function type aliaseslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.