Skip to content

dart2js crashes when it finds "||=" operators (invalid) #31061

Closed
@sigmundch

Description

@sigmundch
var x = false;
main() {
  x ||= true;
}

crashes dart2js with the following error:

The compiler crashed: NoSuchMethodError: The getter 'kind' was called on null.
Receiver: null
Tried calling: kind
#0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
#1      ResolverVisitor.handleUpdate (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:3461:20)
#2      ResolverVisitor.handleStaticOrTopLevelUpdate (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:2892:12)
#3      ResolverVisitor.handleResolvedSendSet (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:2972:14)
#4      ResolverVisitor.handleUnqualifiedSendSet (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:3032:14)
#5      ResolverVisitor.visitSendSet (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:3519:14)
#6      SendSet.accept (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/tree/nodes.dart:824:38)
#7      CommonResolverVisitor.visit (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/resolution_common.dart:32:54)
#8      ResolverVisitor.visitExpressionStatement (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/members.dart:538:5)
#9      ExpressionStatement.accept (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/tree/nodes.dart:1695:38)
#10     CommonResolverVisitor.visit (file:///usr/local/google/home/sigmund/dart/git_all/sdk/pkg/compiler/lib/src/resolution/resolution_common.dart:32:54)

Activity

self-assigned this
on Oct 10, 2017
rakudrama

rakudrama commented on Oct 10, 2017

@rakudrama
Member

This feature appears to be untested on any platform.
The string ||= does not appear in the tests/ directory.

eernstg

eernstg commented on Oct 11, 2017

@eernstg
Member

Issue #26998 already requests an implementation of the compound assignment operators ||= and &&= (but we need to make sure that it actually happens!).

I'll close this because it is subsumed by #26998.

lrhn

lrhn commented on Oct 11, 2017

@lrhn
Member

While the feature isn't implemented yet, the compiler shouldn't be crashing on any syntax.

reopened this on Oct 11, 2017
sigmundch

sigmundch commented on Oct 11, 2017

@sigmundch
MemberAuthor

Correct - I filed the issue because a user run into this and found a crash. Fix added in https://dart-review.googlesource.com/c/sdk/+/12760

added a commit that references this issue on Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sigmundch@rakudrama@lrhn@eernstg

      Issue actions

        dart2js crashes when it finds "||=" operators (invalid) · Issue #31061 · dart-lang/sdk