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

VM nnbd sdk errors #40424

Closed
johnniwinther opened this issue Jan 31, 2020 · 5 comments
Closed

VM nnbd sdk errors #40424

johnniwinther opened this issue Jan 31, 2020 · 5 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release

Comments

@johnniwinther
Copy link
Member

Enabling CFE warning/error reporting for NNBD shows various warnings.

The easiest way to enable the warning/error reporting while building the nnbd sdk is to change performNnbdChecks in pkg/front_end/lib/src/base/processed_options.dart to always return true, and run the compile_platform script directly:

tools/sdks/dart-sdk/bin/dart --packages=.packages --dfe=tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot pkg/front_end/tool/_fasta/compile_platform.dart dart:core -Ddart.vm.product=false -Ddart.developer.causal_async_stacks=true -Ddart.isVM=true --enable-experiment=non-nullable --single-root-scheme=org-dartlang-sdk --single-root-base=. org-dartlang-sdk:///sdk_nnbd/lib/libraries.json out/ReleaseX64NNBD/vm_outline_strong.dill out/ReleaseX64NNBD/vm_platform_strong.dill out/ReleaseX64NNBD/vm_outline_strong.dill

The current warnings are:

org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:21:40: Warning: Optional parameter 'message' doesn't have a default value and its type 'String' doesn't allow null.
bool debugger({bool when: true, String message}) native "Developer_debugger";
                                       ^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:28:15: Warning: Optional parameter 'time' doesn't have a default value and its type 'DateTime' doesn't allow null.
 - 'DateTime' is from 'dart:core'.
    {DateTime time,
              ^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:29:9: Warning: Optional parameter 'sequenceNumber' doesn't have a default value and its type 'int' doesn't allow null.
    int sequenceNumber,
        ^^^^^^^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:32:10: Warning: Optional parameter 'zone' doesn't have a default value and its type 'Zone' doesn't allow null.
 - 'Zone' is from 'dart:async'.
    Zone zone,
         ^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:33:12: Warning: Optional parameter 'error' doesn't have a default value and its type 'Object' doesn't allow null.
 - 'Object' is from 'dart:core'.
    Object error,
           ^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/developer.dart:34:16: Warning: Optional parameter 'stackTrace' doesn't have a default value and its type 'StackTrace' doesn't allow null.
 - 'StackTrace' is from 'dart:core'.
    StackTrace stackTrace}) {
               ^^^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart:86:15: Warning: Optional parameter 'exceptionalReturn' doesn't have a default value and its type 'Object' doesn't allow null.
 - 'Object' is from 'dart:core'.
      [Object exceptionalReturn]) {
              ^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/ffi/ffi.dart:57:15: Warning: Optional parameter 'exceptionalReturn' doesn't have a default value and its type 'Object' doesn't allow null.
 - 'Object' is from 'dart:core'.
      [Object exceptionalReturn]);
              ^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/isolate/isolate.dart:340:15: Warning: Optional parameter 'packageRoot' doesn't have a default value and its type 'Uri' doesn't allow null.
 - 'Uri' is from 'dart:core'.
          Uri packageRoot,
              ^^^^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/isolate/isolate.dart:525:15: Warning: Optional parameter 'response' doesn't have a default value and its type 'Object' doesn't allow null.
 - 'Object' is from 'dart:core'.
      {Object response, int priority = immediate});
              ^^^^^^^^
org-dartlang-sdk:///sdk_nnbd/lib/ffi/struct.dart:27:25: Warning: Assigning value of type 'Pointer<Null?>' to a variable of type 'Pointer<Struct>'.
 - 'Pointer' is from 'dart:ffi'.
 - 'Struct' is from 'dart:ffi'.
  Struct() : _addressOf = nullptr;
                        ^
org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/bin/vmservice_io.dart:48:5: Warning: Assigning value of type 'Server?' to a variable of type 'Server'.
 - 'Server' is from 'dart:vmservice_io'.
    return server;
    ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:163:15: Warning: Assigning value of type 'int' to a variable of type 'Null?'.
      ..[0] = 0 // Make room for OOB message type.
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:164:27: Warning: Assigning value of type 'SendPort' to a variable of type 'Null?'.
 - 'SendPort' is from 'dart:isolate'.
      ..[1] = receivePort.sendPort
                          ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:166:15: Warning: Assigning value of type 'String?' to a variable of type 'Null?'.
      ..[3] = method
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:167:15: Warning: Assigning value of type 'List<String>' to a variable of type 'Null?'.
 - 'List' is from 'dart:core'.
      ..[4] = keys
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:168:15: Warning: Assigning value of type 'List<String>' to a variable of type 'Null?'.
 - 'List' is from 'dart:core'.
      ..[5] = values;
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:211:15: Warning: Assigning value of type 'int' to a variable of type 'Null?'.
      ..[0] = 0 // Make room for OOB message type.
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:212:27: Warning: Assigning value of type 'SendPort' to a variable of type 'Null?'.
 - 'SendPort' is from 'dart:isolate'.
      ..[1] = receivePort.sendPort
                          ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:214:15: Warning: Assigning value of type 'String?' to a variable of type 'Null?'.
      ..[3] = method
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:215:15: Warning: Assigning value of type 'List<String>' to a variable of type 'Null?'.
 - 'List' is from 'dart:core'.
      ..[4] = keys
              ^
org-dartlang-sdk:///sdk_nnbd/lib/vmservice/message.dart:216:15: Warning: Assigning value of type 'List<dynamic>' to a variable of type 'Null?'.
 - 'List' is from 'dart:core'.
      ..[5] = values;
              ^
org-dartlang-sdk:///sdk_nnbd/lib/cli/wait_for.dart:63:25: Warning: Method 'call' is called on 'void Function(int)?' which is potentially null.
Try calling using ?. instead.
    _waitForEventClosure(timeout == null ? 0 : max(1, timeout.inMilliseconds));
                        ^
org-dartlang-sdk:///sdk_nnbd/lib/cli/wait_for.dart:63:25: Warning: Expression of type 'void Function(int)?' is used as a function, but it's potentially null.
Try calling using ?.call instead.
    _waitForEventClosure(timeout == null ? 0 : max(1, timeout.inMilliseconds));
                        ^
@johnniwinther johnniwinther added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. NNBD Issues related to NNBD Release labels Jan 31, 2020
@a-siva
Copy link
Contributor

a-siva commented Mar 3, 2020

Landed https://dart-review.googlesource.com/c/sdk/+/137250 to fix all errors reported by CFE when performNnbdChecks is turned on.
There is one remaining error which is a CFE issue -

output: org-dartlang-sdk:///sdk_nnbd/lib/_internal/vm/bin/socket_patch.dart:365:24: Warning: This constructor doesn't initialize field 'localAddress' and its type 'InternetAddress' doesn't allow null.
 - 'InternetAddress' is from 'dart:io'.
  late InternetAddress localAddress;
                       ^^^^^^^^^^^^

@a-siva a-siva assigned chloestefantsova and unassigned a-siva Mar 3, 2020
@a-siva
Copy link
Contributor

a-siva commented Mar 3, 2020

Transferring issue back to CFE to close once the CFE fix lands.

@a-siva a-siva added area-front-end Use area-front-end for front end / CFE / kernel format related issues. and removed area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Mar 3, 2020
@chloestefantsova
Copy link
Contributor

I think with https://dart-review.googlesource.com/c/sdk/+/137787 landed, the issue is fixed.

@a-siva
Copy link
Contributor

a-siva commented Mar 10, 2020

Now that all the errors found while compiling the SDK have been fixed, does the CFE turn on performNnbdChecks to true by default when --enable-experiment=non-nullable is specified?

@johnniwinther
Copy link
Member Author

It's the plan. I've created #40980 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

3 participants