You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a generic type Pair<P,Q> that I want to extend a generic super class.
This seems to generate a checked_mode error when the super class has one type param.
class A<E>{}
class Pair<P,Q> extends A {
final P fst;
final Q snd;
Pair(this.fst,this.snd);
}
main() {
print(new Pair<int,int>(1,2));//OK no problems
print(new Pair<String,int>("1",2));//checked-mode type err
}
krukow:~/scratchpad$ dart_bin --enable_type_checks generic.dart
Instance of 'Pair<int, int>'
Unhandled exception:
Failed type check: type Smi is not assignable to type String of snd in /Users/krukow/scratchpad/generic.dart at line 5, column 22.
0. Function: 'Pair.Pair.' url: '/Users/krukow/scratchpad/generic.dart' line:5 col:22
1. Function: '::.main' url: '/Users/krukow/scratchpad/generic.dart' line:12 col:9
where as if it has two:
class A<E,F>{}
we get:
krukow:~/scratchpad$ dart_bin --enable_type_checks generic.dart
Instance of 'Pair<int, int>'
Instance of 'Pair<String, int>'
Using dart_bin as of Dec. 6th.
The text was updated successfully, but these errors were encountered:
This issue was originally filed by karl.kruk...@gmail.com
I have a generic type Pair<P,Q> that I want to extend a generic super class.
This seems to generate a checked_mode error when the super class has one type param.
class A<E>{}
class Pair<P,Q> extends A {
final P fst;
final Q snd;
Pair(this.fst,this.snd);
}
main() {
print(new Pair<int,int>(1,2));//OK no problems
print(new Pair<String,int>("1",2));//checked-mode type err
}
krukow:~/scratchpad$ dart_bin --enable_type_checks generic.dart
Instance of 'Pair<int, int>'
Unhandled exception:
Failed type check: type Smi is not assignable to type String of snd in /Users/krukow/scratchpad/generic.dart at line 5, column 22.
0. Function: 'Pair.Pair.' url: '/Users/krukow/scratchpad/generic.dart' line:5 col:22
1. Function: '::.main' url: '/Users/krukow/scratchpad/generic.dart' line:12 col:9
where as if it has two:
class A<E,F>{}
we get:
krukow:~/scratchpad$ dart_bin --enable_type_checks generic.dart
Instance of 'Pair<int, int>'
Instance of 'Pair<String, int>'
Using dart_bin as of Dec. 6th.
The text was updated successfully, but these errors were encountered: