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
And for the record, that's the spec-mandated behavior, even if it looks odd that because a T type variable is in scope, it turns T() into this.T() where the T no longer refers to the type variable.
Given the following code
class C<T> {
foo() => T();
}
main() {
print(new C<int>().foo());
}
We get the following error message, that claims that no static method T was found, when in reality it is a missing instance method.
Unhandled exception:
No constructor 'C.foo' declared in class 'C'.
NoSuchMethodError : method not found: 'C.foo'
Receiver: Type: class 'C'
Arguments: [...]
0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:99:5)
1 main (file:///Users/gbracha/dart/dart/dart-sdk/C.dart:7:23)
gbracha-macpro:dart-sdk gbracha$ emacs C.dart
gbracha-macpro:dart-sdk gbracha$ ./bin/dart C.dart
Unhandled exception:
No static method 'T' declared in class 'C'.
NoSuchMethodError : method not found: 'T'
Receiver: Type: class 'C'
Arguments: [...]
0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:99:5)
1 C.foo (file:///Users/gbracha/dart/dart/dart-sdk/C.dart:3:12)
2 main (file:///Users/gbracha/dart/dart/dart-sdk/C.dart:7:25)
The text was updated successfully, but these errors were encountered: