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
better error/warning message if typedef is defined inside class #3001
Comments
Hi Gram, Can you post the entire script here? Thanks! |
Added Area-Editor, Triaged labels. |
I think I found the issue. If I move the typedef to the top level things are okay, but if I put it inside a class things go awry. So this is my error, as typedef is not allowed within a class it seems. However, the error messages were very unhelpful and perhaps should be improved. |
Moving to Analyzer. Removed Area-Editor label. |
Changed the title to: "better error/warning message if typedef is defined inside class". |
Added this to the Later milestone. |
Removed this from the M3 milestone. |
This comment was originally written by amouravski@google.com Added Editor-AnalysisEngine label. |
This is still a problem in analysis engine but will be addressed as part of recovery. Set owner to @bwilkerson. |
Added Analyzer-Recovery label. |
Removed Type-Defect label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
Some concreteness: $ cat issue-3001.dart class Foo { $ dartanalyzer issue-3001.dart This is with dart 1.7.0-edge.40134. I think the desired behavior is 1 error along the lines of: |
Added Started label. |
https://codereview.chromium.org/780403002/ (bleeding edge revision 42154) This change causes us to produce one reasonable error (like the one suggested) for the function type alias itself but doesn't cause the name of the function type to be available in scope, so the field is still marked with a warning. Added Fixed label. |
I have a class Reporter, that has a couple of members that are references to callback functions. If I declare these with 'var' things are fine. If I try to use typedefs for the signatures and strongly type the members compilation breaks in weird ways.
For example, if instead of:
var _urlFormatter;
I use:
typedef String _UrlFormatter(String baseUrl,
Map marks, Map starts, Map measures);
_UrlFormatter _urlFormatter;
I get numerous compiler errors on other lines, not on these lines. These compiler errors are, for declarations, "Duplicate top-level declaration of <foo>", and then, when foo is references, "Cannot resolve <foo>"
This is in the DartEditor on Goobuntu. Build 7243.
The text was updated successfully, but these errors were encountered: