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

Dots in import prefix names trigger NPE in dartc.jar #266

Closed
DartBot opened this issue Oct 30, 2011 · 8 comments
Closed

Dots in import prefix names trigger NPE in dartc.jar #266

DartBot opened this issue Oct 30, 2011 · 8 comments

Comments

@DartBot
Copy link

DartBot commented Oct 30, 2011

This issue was originally filed by bernd.par...@gmail.com


What steps will reproduce the problem?

  1. Given the file myLibrary.dart

library("wibble");

class MyClass {}

  1. And the file myApp.dart
    #library("myApp");
    #import("myLibrary.dart", prefix:"tests.myLib");
    void main() {
      var my_class = new tests.myLib.MyClass(); // <== fails here
    }

What is the expected output? What do you see instead?

EXPECTED: no error.

ACTUAL:

java.lang.NullPointerException
    at com.google.dart.compiler.resolver.ResolutionContext$Selector.visitPropertyAccess(ResolutionContext.java:280)
    at com.google.dart.compiler.resolver.ResolutionContext$Selector.visitPropertyAccess(ResolutionContext.java:271)
    at com.google.dart.compiler.ast.DartPropertyAccess.accept(DartPropertyAccess.java:82)
    at com.google.dart.compiler.resolver.ResolutionContext.resolveName(ResolutionContext.java:235)
    at com.google.dart.compiler.resolver.ResolutionContext.resolveType(ResolutionContext.java:162)
    at com.google.dart.compiler.resolver.ResolutionContext.resolveType(ResolutionContext.java:156)
    at com.google.dart.compiler.resolver.ResolveVisitor.resolveType(ResolveVisitor.java:90)
    at com.google.dart.compiler.resolver.Resolver$ResolveElementsVisitor$1.visitTypeNode(Resolver.java:885)
    at com.google.dart.compiler.resolver.Resolver$ResolveElementsVisitor$1.visitTypeNode(Resolver.java:882)
    at com.google.dart.compiler.ast.DartTypeNode.accept(DartTypeNode.java:65)
...

What version of the product are you using? On what operating system?
dartc.jar from 10/28/11 compiled following the instructions from the Dart Wiki.
OS=OSX 10.6.8

Please provide any additional information below.
Probably not related to issue #160.

@DartBot
Copy link
Author

DartBot commented Oct 30, 2011

This comment was originally written by bernd.par...@gmail.com


Correction about the expected output:
The spec says that prefix must be a stringLiteral and from what I can tell "." is not in stringLiteral.

stringLiteral -> SINGLE LINE STRING -> STRING CONTENT DQ -> STRING INTERPOLATION ->IDENTIFIER NO DOLLAR -> IDENTIFIER START NO DOLLAR -> LETTER:
'a' .. 'z'
'A' ..'Z'

In other words, the expected output should be an error message complaining about prefix:"tests.myLib".
Sorry about that!

@DartBot
Copy link
Author

DartBot commented Oct 31, 2011

This comment was originally written by drfibonacci@google.com


Added Area-Compiler, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Nov 1, 2011

This comment was originally written by mmendez@google.com


John, can you take a look at this? I think that you may have fixed this already.


Set owner to @jtmcdole.

@jtmcdole
Copy link
Contributor

jtmcdole commented Nov 1, 2011

String Literals can contain '.' and other valid characters. The last sentence in 12.1 of Rev 0.03 of the specification states makes the prefix string even more restrictive:
  "It is a compile-time error if the value of s2 is not a valid identifier."
Which makes it only valid for A-Za-z_. One could argue the use of double quotes is overkill.

Accepted and looking into it. I didn't have an NPE with the latest bleeding edge (with issue #160), but this should still report an error.


Added Accepted label.

@jtmcdole
Copy link
Contributor

jtmcdole commented Nov 1, 2011

CL posted for review: http://codereview.chromium.org/8441001


Added Started label.

@DartBot
Copy link
Author

DartBot commented Nov 2, 2011

This comment was originally written by bernd.par...@gmail.com


Thanks for the quick response!
I was referring to the language spec from dartlang.org, which is probably older than 0.3.

@jtmcdole
Copy link
Contributor

jtmcdole commented Nov 2, 2011

@jtmcdole
Copy link
Contributor

jtmcdole commented Nov 3, 2011

Added Fixed label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants