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

"late int v; v;" is expected to be fine but VM throws runtime error #39814

Closed
a-siva opened this issue Dec 17, 2019 · 5 comments
Closed

"late int v; v;" is expected to be fine but VM throws runtime error #39814

a-siva opened this issue Dec 17, 2019 · 5 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@a-siva
Copy link
Contributor

a-siva commented Dec 17, 2019

language/nnbd/static_errors/not_assigned_local_initializer_test.dart expects
late int v; v; //# 04: ok to be a valid construct but we get an error

Unhandled exception:
LateInitializationError: v
#0      _LateInitializationError._throwNew (dart:core-patch/errors_patch.dart:600:5)
#1      main (file:///usr/local/google/home/asiva/workspace/dart-nnbd/sdk/out/DebugX64NNBD/generated_tests/language/nnbd/static_errors/not_assigned_local_initializer_test_04.dart:18:15)
#2      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

@a-siva a-siva added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) NNBD Issues related to NNBD Release labels Dec 17, 2019
@a-siva a-siva added this to the D29 Release milestone Dec 17, 2019
@a-siva
Copy link
Contributor Author

a-siva commented Dec 17, 2019

/cc @crelier @liamappelbe

@lrhn
Copy link
Member

lrhn commented Dec 17, 2019

I do not believe this to be a valid construct.

I would expect reading a variable which is definitely unassigned to be an error, even if the variable is late. The late only affects reads which are potentially unassigned.

@leafpetersen Or did we not do that?

@leafpetersen
Copy link
Member

If this were statically valid, it would be a runtime error. It is intended to be a static error, but the spec was missing this error. I have a PR adding the static error here: dart-lang/language#750 .

@leafpetersen leafpetersen self-assigned this Dec 17, 2019
@leafpetersen
Copy link
Member

I'll fix the test.

@leafpetersen
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants