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

NPE from CompileTimeConstantAnalyzer - optional parameter set to getter #999

Closed
jtmcdole opened this issue Dec 29, 2011 · 3 comments
Closed

Comments

@jtmcdole
Copy link
Contributor

Compile:
Function get asdf() {
  print("getter called");
  return () => print("function called:");
}

toplevel([var x = asdf]) {
  x();
}

void main() {
  toplevel();
}

Output:

test1.dart:6: Expected constant expression
     5:
     6: toplevel([var x = asdf]) {
test1.dart:1: Expected constant expression
     1: Function get asdf() {
java.lang.NullPointerException
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$ExpressionVisitor.getMostSpecificType(CompileTimeConstantAnalyzer.java:132)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$ExpressionVisitor.visitField(CompileTimeConstantAnalyzer.java:250)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$ExpressionVisitor.visitField(CompileTimeConstantAnalyzer.java:65)
    at com.google.dart.compiler.ast.DartField.accept(DartField.java:78)
    at com.google.dart.compiler.ast.DartNodeTraverser.visit(DartNodeTraverser.java:413)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$ExpressionVisitor.visitIdentifier(CompileTimeConstantAnalyzer.java:295)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$ExpressionVisitor.visitIdentifier(CompileTimeConstantAnalyzer.java:65)
    at com.google.dart.compiler.ast.DartIdentifier.accept(DartIdentifier.java:78)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer.checkConstantExpression(CompileTimeConstantAnalyzer.java:585)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer.access$700(CompileTimeConstantAnalyzer.java:63)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$FindCompileTimeConstantExpressionsVisitor.visitMethodDefinition(CompileTimeConstantAnalyzer.java:500)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$FindCompileTimeConstantExpressionsVisitor.visitMethodDefinition(CompileTimeConstantAnalyzer.java:486)
    at com.google.dart.compiler.ast.DartMethodDefinition.accept(DartMethodDefinition.java:83)
    at com.google.dart.compiler.ast.DartNodeTraverser.visit(DartNodeTraverser.java:413)
    at com.google.dart.compiler.ast.DartUnit.visitChildren(DartUnit.java:99)
    at com.google.dart.compiler.ast.DartNodeTraverser.visitNode(DartNodeTraverser.java:54)
    at com.google.dart.compiler.ast.DartNodeTraverser.visitUnit(DartNodeTraverser.java:391)
    at com.google.dart.compiler.ast.DartUnit.accept(DartUnit.java:107)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer.exec(CompileTimeConstantAnalyzer.java:590)
    at com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer$Phase.exec(CompileTimeConstantAnalyzer.java:555)
    at com.google.dart.compiler.DartCompiler$Compiler.compileLibraries(DartCompiler.java:713)
    at com.google.dart.compiler.DartCompiler$Compiler.compile(DartCompiler.java:178)
    at com.google.dart.compiler.DartCompiler$Compiler.access$200(DartCompiler.java:122)
    at com.google.dart.compiler.DartCompiler.compileLib(DartCompiler.java:1147)
    at com.google.dart.compiler.DartCompiler.compileLib(DartCompiler.java:1123)
    at com.google.dart.compiler.DartCompiler.compileApp(DartCompiler.java:1064)
    at com.google.dart.compiler.DartCompiler.compilerMain(DartCompiler.java:997)
    at com.google.dart.compiler.DartCompiler.compilerMain(DartCompiler.java:984)
    at com.google.dart.compiler.DartCompiler.main(DartCompiler.java:944)

@jtmcdole
Copy link
Contributor Author

Set owner to @jtmcdole.

@jtmcdole
Copy link
Contributor Author

http://codereview.chromium.org/9052002


Added Started label.

@jtmcdole
Copy link
Contributor Author

dart-bot pushed a commit that referenced this issue Feb 22, 2021
2021-02-22 whesse@google.com Fix syntax error in test expectation in ffi test (#1002)
2021-02-20 irina.arkhipets@gmail.com #1000: Missing Issue tags added.
2021-02-20 irina.arkhipets@gmail.com Issue #1000: tests updated according to the recent result analysis
2021-02-20 sgrekhov@unipro.ru Roll failures fixed
2021-02-19 sgrekhov@unipro.ru #999. Missed experiment flags added
2021-02-19 sgrekhov@unipro.ru #993. 32 and 64-bit integer tests added
2021-02-19 sgrekhov@unipro.ru #993. Change test to expect compile error if struct subclass created by the constructor
2021-02-19 sgrekhov@unipro.ru #993. Remove tests that run "nm" command
2021-02-18 sgrekhov@unipro.ru #993. More ffi tests added
2021-02-18 irina.arkhipets@gmail.com Instantiate-to-bounds tests apdated according to the SDK Issues 44223, 42446 evaluation.
2021-02-17 irina.arkhipets@gmail.com Issue #535: nnbd-strong requirement added to the tests, more tests for constant evaluation and canonicalization added.
2021-02-17 sgrekhov@unipro.ru Some of type aliases tests fixed
2021-02-17 sgrekhov@unipro.ru #993. More Struct tests added
2021-02-16 irina.arkhipets@gmail.com Issue #535: more tests for constant evaluation and canonicalization added.
2021-02-12 irina.arkhipets@gmail.com Fixes #994: test expectesions updated according to the recent SDK changes.
2021-02-12 sgrekhov@unipro.ru #993. More Struct tests added
2021-02-12 irina.arkhipets@gmail.com Merge remote-tracking branch 'origin/master'
2021-02-12 sgrekhov@unipro.ru #993. NativeType and Struct tests added
2021-02-11 irina.arkhipets@gmail.com Fixes #991: tests updated according to the recent SDK changes.
2021-02-08 sgrekhov@unipro.ru #993. sizeOf() tests added
2021-02-05 sgrekhov@unipro.ru #993. More tests for DynamicLibrary added
2021-02-04 sgrekhov@unipro.ru #993. DynamicLibrary constructors tests added
2021-02-03 sgrekhov@unipro.ru #993. co19 ffi tests. Initial commit
2021-02-02 sgrekhov@unipro.ru Fixes #992. Boolean conditional evaluation tests added
2021-02-01 irina.arkhipets@gmail.com Fixes #990: tests updated according to the recent SDK changes.
2021-01-28 irina.arkhipets@gmail.com Fixes #979: I-2-b tests updated according to the recent changes for dart-lang/language#1133
2021-01-28 irina.arkhipets@gmail.com Fixes #984: I-2-b tests updated according to the recent changes for dart-lang/language#1133
2021-01-27 sgrekhov@unipro.ru Fixes #989. Runtime type equality operator tests added
2021-01-26 irina.arkhipets@gmail.com Fixes #988: Static warning checks corrected.
2021-01-25 sgrekhov@unipro.ru Fixes #987. Local variables and inference tests added

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,analyzer-nnbd-mac-release-try,analyzer-nnbd-win-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-mac-release-x64-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I78ba37f9c74d2afc360ef5fbd51d01ab75239fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186146
Reviewed-by: Jonas Termansen <sortie@google.com>
copybara-service bot pushed a commit that referenced this issue Aug 21, 2023
… webdev

Revisions updated by `dart tools/rev_sdk_deps.dart`.

collection (https://github.com/dart-lang/collection/compare/1ed009e..1a9b7eb):
  1a9b7eb  2023-08-15  ebraminio  Minor typo fix (#304)

dartdoc (https://github.com/dart-lang/dartdoc/compare/5cfb1f3..e148373):
  e1483735  2023-08-14  Parker Lougheed  Adjust links to dart.dev class modifier documentation (#3476)

http (https://github.com/dart-lang/http/compare/9f167a7..631d4ec):
  631d4ec  2023-08-18  Alex James  Add java_http .gitattributes file (#999)
  58a5462  2023-08-17  Alex James  JavaClient can stream the HTTP response body (#1005)
  df1f625  2023-08-15  Brian Quinlan  Add some additional header tests (#1006)

mockito (https://github.com/dart-lang/mockito/compare/ff79de6..e54a006):
  e54a006  2023-08-18  Copybara-Service  Merge pull request #685 from LuisDuarte1:feature/build-extensions
  5f3a4ca  2023-08-18  Luís Duarte  Format files
  2d4ec1e  2023-08-17  Luís Duarte  Update lib/src/builder.dart
  bc06f9f  2023-08-17  Luís Duarte  Make builder not merge generic extension.
  af043a0  2023-08-16  Luís Duarte  Replace double-quotes with single quotes
  034e6c1  2023-08-16  Luís Duarte  Update lib/src/builder.dart
  4ff995f  2023-08-10  Luís Duarte  Make MockBuilder support build_extensions option.

protobuf (https://github.com/dart-lang/protobuf/compare/a852ba4..5e8f36b):
  5e8f36b  2023-08-16  Ömer Sinan Ağacan  Add dart2wasm targets to benchmark builder (#806)
  41d0156  2023-08-15  Ömer Sinan Ağacan  Document why we add '$' prefix to result local in constructors (#870)
  41193fd  2023-08-14  Devon Carew  Rename a local variable to avoid proto field name conflicts, re-generate protos (#869)

test (https://github.com/dart-lang/test/compare/bc0a992..d0fc4bd):
  d0fc4bde  2023-08-16  Nate Bosch  Extend the timeout for runtime_matrix_test (#2084)
  cdf80280  2023-08-16  Nate Bosch  Add some console logging to browser test startup (#2083)
  6146c292  2023-08-16  Nate Bosch  Add an ignore for an SDK deprecation (#2082)
  27142079  2023-08-15  Parker Lougheed  Fix improperly rendered changelog entry (#2081)
  46cf4de0  2023-08-15  Nate Bosch  Timeout browser suite loads (#2080)

tools (https://github.com/dart-lang/tools/compare/295ff92..2be6c2e):
  2be6c2e  2023-08-16  Ben Konyi  Added `dartCliCommandExecuted` and `pubGet` events (#123)

webdev (https://github.com/dart-lang/webdev/compare/19aad27..fc876cb):
  fc876cb0  2023-08-16  Elliott Brooks  Reset Webdev to 3.0.8-wip (#2197)
  1aa7c523  2023-08-16  Elliott Brooks  Prepare webdev for release to 3.0.7 (#2196)

Change-Id: Idc228d0f3f70f5b3e7bfc6e777260dfe84fe96f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322060
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
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

1 participant