Skip to content
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

Analyzer fails utils/dummy_compiler_test #4539

Closed
peter-ahe-google opened this issue Aug 16, 2012 · 10 comments
Closed

Analyzer fails utils/dummy_compiler_test #4539

peter-ahe-google opened this issue Aug 16, 2012 · 10 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Milestone

Comments

@peter-ahe-google
Copy link
Contributor

The test utils/dummy_compiler_test is probably the biggest real Dart program we have. It uses the dart2js compiler to compile an empty file.

When the analyzer cannot pass this test, it is losing a lot of coverage and miss an opportunity to automatically detect bugs by testing a real world application that is constantly changing.

dart://io/runtime/http_impl.dart:399: Named parameters cannot start with an '_' character (sourced from dart://io/io_runtime.dart)
   398: class _ContentType extends _HeaderValue implements ContentType {
   399: _ContentType([String this._primaryType = "", String this.subType = ""]);
dart://io/runtime/http_impl.dart:399: Named parameters cannot start with an '
' character (sourced from dart://io/io_runtime.dart)
   398: class _ContentType extends _HeaderValue implements ContentType {
   399: _ContentType([String this._primaryType = "", String this._subType = ""]);
Compilation failed with 2 problems.

@clayberg
Copy link

Added this to the M1 milestone.

@scheglov
Copy link
Contributor

Spec 0.11 still says "It is a compile-time error if the name of a named optional parameter begins with an ‘_’ character."

It seems for me that until unhold of "Issue #4288/4289 remove old optional parameter syntax" Analyzer is correct when reports this problem. It understands both [] and {} parameters as named optional.

So, this code uses named optional parameter and produces error.
_ContentType([String this._primaryType = "", String this._subType = ""]);

@scheglov
Copy link
Contributor

Set owner to @scheglov.

@scheglov
Copy link
Contributor

Added AsDesigned label.

@peter-ahe-google
Copy link
Contributor Author

Before you close this bug, please explain what is wrong with this program:

#import('dart:io');

main() {
  print('Hello, World');
}

It suffers the same problem.


Added Triaged label.

@scheglov
Copy link
Contributor

I don't see any problem.


Attachment:
[Screen shot 2012-08-21 at 4.31.15 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-4539/comment-6/Screen shot 2012-08-21 at 4.31.15 PM.png) (16.93 KB)

@peter-ahe-google
Copy link
Contributor Author

This is what I see at revision 10980:

$ cat fisk.dart
#import('dart:io');

main() {
  print('Hello, World');
}
$ ./xcodebuild/ReleaseIA32/dart-sdk/bin/dart_analyzer fisk.dart
dart://io/runtime/http_parser.dart:602: Unreachable code in case statement (sourced from dart://io/io_runtime.dart)
   601: return "1.0";
   602: break;
dart://io/runtime/http_parser.dart:605: Unreachable code in case statement (sourced from dart://io/io_runtime.dart)
   604: return "1.1";
   605: break;
dart://io/runtime/websocket_impl.dart:115: Unreachable code in case statement (sourced from dart://io/io_runtime.dart)
   114: throw new WebSocketException("Protocol error");
   115: break;
dart://io/runtime/websocket_impl.dart:193: Unreachable code in case statement (sourced from dart://io/io_runtime.dart)
   192: throw new WebSocketException("Protocol error");
   193: break;
dart://io/runtime/websocket_impl.dart:208: Unreachable code in case statement (sourced from dart://io/io_runtime.dart)
   207: throw new WebSocketException("Protocol error");
   208: break;
dart://io/runtime/http_impl.dart:430: Named parameters cannot start with an '_' character (sourced from dart://io/io_runtime.dart)
   429: class _ContentType extends _HeaderValue implements ContentType {
   430: _ContentType([String this._primaryType = "", String this.subType = ""]);
dart://io/runtime/http_impl.dart:430: Named parameters cannot start with an '
' character (sourced from dart://io/io_runtime.dart)
   429: class _ContentType extends _HeaderValue implements ContentType {
   430: _ContentType([String this._primaryType = "", String this._subType = ""]);
Compilation failed with 2 problems.
$

@scheglov
Copy link
Contributor

OK, I see.
It seems that we should lift this limitation until we will complete migration to new optional parameters syntax.

I will prepare CL shortly.


Added Accepted label.

@scheglov
Copy link
Contributor

@scheglov
Copy link
Contributor

@peter-ahe-google peter-ahe-google added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Aug 22, 2012
@peter-ahe-google peter-ahe-google added this to the M1 milestone Aug 22, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

3 participants