New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VM should provide more actionable details for typedef mismatch #5740
Comments
This comment was originally written by shalmak...@gmail.com It seems to me that there are 2 additional issues here - // ... 2 - the error message doesn't accurately describe the problem because type '(int) => void' IS in fact identical to RequestAnimationFrameCallback. If it would say '(myobject, int) => void' is not a subtype etc. then I would understand why it is failing. I don't know whether #1 would be considered a defect or a desirable behavior. I would either expect methods to be acceptable as callbacks with "this" being passed implicitly, or alternately I would expect an error message that would explicitly show the problematic "this" argument. |
Removed Priority-Medium label. |
This comment was originally written by @mhausner Would be nice to have a simpler, standalone example that reproduces the situation. Removed Type-Defect label. |
My pleasure. Here's an app: typedef bool DoThing(int x); run(DoThing callback) { main() { Run it this way: sethladd:~/tmp$ dart --checked typedef.dart Get this error: Unhandled exception: Suggestion: Can we print out what the signature of DoThing is? Maybe: type '() => dynamic' is not a subtype of type '(int) => bool' of 'callback'. Thanks for taking a look. |
I am still puzzled as to what we are supposed to fix here. DoThing takes an int parameter, it is being assigned a value that takes no parameter. Mismatch, checked mode failure, all is well. The one thing that could be worded better is the "of 'callback'." cc @gbracha. |
Hi Ivan, Can we tell the user what the signature of DoThing is? That would be really helpful. And yes, "of callback" isn't very clear. |
dart ~/dart/Bug5740.dart NoSuchMethodError: incorrect number of arguments passed to method named 'main.' |
For an error such as:
Exception: type '(int) => void' is not a subtype of type 'RequestAnimationFrameCallback' of 'callback'.
Stack Trace: #0 _DOMWindowImpl.requestAnimationFrame (/Volumes/data/b/build/slave/dartium-mac-full/build/src/xcodebuild/DerivedSources/Release/webkit/bindings/dart/dart/WindowImpl.dart:190:59)
1 SolarSystem.requestRedraw (http://127.0.0.1:3030/Users/sethladd/Code/Dart/dart/samples/solar/solar.dart:145:33)
2 SolarSystem._start (http://127.0.0.1:3030/Users/sethladd/Code/Dart/dart/samples/solar/solar.dart:111:18)
3 SolarSystem.start.<anonymous closure> (http://127.0.0.1:3030/Users/sethladd/Code/Dart/dart/samples/solar/solar.dart:72:13)
4 FutureImpl._complete (bootstrap_impl:605:19)
5 FutureImpl._complete (bootstrap_impl:613:5)
6 FutureImpl._setValue (bootstrap_impl:627:14)
7 CompleterImpl.complete (bootstrap_impl:710:26)
8 _completeMeasurementFutures._completeMeasurementFutures (/Volumes/data/b/build/slave/dartium-mac-full/build/src/dart/lib/html/src/Measurement.dart:115:35)
9 _MeasurementScheduler._onCallback (/Volumes/data/b/build/slave/dartium-mac-full/build/src/dart/lib/html/src/Measurement.dart:34:19)
10 _MutationObserverScheduler._handleMutation._handleMutation (/Volumes/data/b/build/slave/dartium-mac-full/build/src/dart/lib/html/src/Measurement.dart:63:21)
It would be very nice if the error message also reported what RequestAnimationFrameCallback's signature is. The current message doesn't tell me how to fix the problem.
Also, the "of 'callback'" isn't clear.
The text was updated successfully, but these errors were encountered: