Move test infer_use_of_void to inference_new

This test's expectations reflect a drawback in analyzer's type
inference--it doesn't infer the correct types for calls to methods
returning `void` when those calls occur outside of a method body.  The
new front_end type inference engine does the right thing.

Accordingly, we have to move the test to inference_new, so that we can
update its expectations without breaking analyzer's test code.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2953903002 .
This commit is contained in:
Paul Berry 2017-06-23 07:33:48 -07:00
parent c68e5cc67d
commit c4ecf098aa
13 changed files with 108 additions and 5 deletions

View file

@ -199,7 +199,6 @@ inference/infer_types_on_generic_instantiations_in_library_cycle_a: Fail
inference/infer_types_on_generic_instantiations_infer: Fail
inference/infer_types_on_loop_indices_for_each_loop: Fail
inference/infer_types_on_loop_indices_for_loop_with_inference: Fail
inference/infer_use_of_void: Fail
inference/infer_variable_void: Fail
inference/inferred_initializing_formal_checks_default_value: Fail
inference/inferred_nonstatic_field_depends_on_static_field_complex: Fail

View file

@ -0,0 +1,14 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/*@testedFeatures=inference*/
library test;
void f() {}
void g() {
var /*@type=void*/ x = f();
}
main() {}

View file

@ -0,0 +1,8 @@
library test;
import self as self;
static method f() → void {}
static method g() → void {
dynamic x = self::f();
}
static method main() → dynamic {}

View file

@ -0,0 +1,8 @@
library test;
import self as self;
static method f() → void {}
static method g() → void {
dynamic x = self::f();
}
static method main() → dynamic {}

View file

@ -0,0 +1,9 @@
library test;
import self as self;
static method f() → void
;
static method g() → void
;
static method main() → dynamic
;

View file

@ -0,0 +1,8 @@
library test;
import self as self;
static method f() → void {}
static method g() → void {
void x = self::f();
}
static method main() → dynamic {}

View file

@ -13,7 +13,7 @@ class C extends B {
/*@topType=void*/ f() {}
}
var /*@topType=dynamic*/ x =
var /*@topType=void*/ x =
new C(). /*info:USE_OF_VOID_RESULT*/ /*@target=C::f*/ f();
main() {

View file

@ -0,0 +1,20 @@
library test;
import self as self;
import "dart:core" as core;
class B extends core::Object {
constructor •() → void
: super core::Object::•()
;
method f() → void {}
}
class C extends self::B {
constructor •() → void
: super self::B::•()
;
method f() → dynamic {}
}
static field dynamic x = new self::C::•().f();
static method main() → dynamic {
self::x;
}

View file

@ -0,0 +1,19 @@
library test;
import self as self;
import "dart:core" as core;
class B extends core::Object {
constructor •() → void
;
method f() → void
;
}
class C extends self::B {
constructor •() → void
;
method f() → dynamic
;
}
static field dynamic x;
static method main() → dynamic
;

View file

@ -0,0 +1,20 @@
library test;
import self as self;
import "dart:core" as core;
class B extends core::Object {
constructor •() → void
: super core::Object::•()
;
method f() → void {}
}
class C extends self::B {
constructor •() → void
: super self::B::•()
;
method f() → void {}
}
static field void x = new self::C::•().{self::C::f}();
static method main() → dynamic {
self::x;
}

View file

@ -280,7 +280,6 @@ inference/infer_types_on_generic_instantiations_in_library_cycle_a: Crash
inference/infer_types_on_generic_instantiations_infer: Crash
inference/infer_types_on_loop_indices_for_each_loop: Crash
inference/infer_types_on_loop_indices_for_loop_with_inference: Fail
inference/infer_use_of_void: Crash
inference/infer_variable_void: Crash
inference/inferred_initializing_formal_checks_default_value: Crash
inference/inferred_nonstatic_field_depends_on_static_field_complex: Crash
@ -400,6 +399,7 @@ inference_new/infer_assign_to_ref: Crash
inference_new/infer_instance_accessor_ref: Crash
inference_new/infer_instance_field_ref: Crash
inference_new/infer_instance_field_ref_circular: Crash
inference_new/infer_use_of_void: Crash
inference_new/property_get_toplevel: Crash
inference_new/strongly_connected_component: Crash

View file

@ -179,7 +179,6 @@ inference/infer_types_on_generic_instantiations_in_library_cycle_a: Fail
inference/infer_types_on_generic_instantiations_infer: Fail
inference/infer_types_on_loop_indices_for_each_loop: Fail
inference/infer_types_on_loop_indices_for_loop_with_inference: Fail
inference/infer_use_of_void: Fail
inference/infer_variable_void: Fail
inference/inferred_initializing_formal_checks_default_value: Fail
inference/inferred_nonstatic_field_depends_on_static_field_complex: Fail

View file

@ -58,7 +58,6 @@ inference/downwards_inference_on_function_of_t_using_the_t: Fail
inference/future_then_explicit_future: Fail
inference/generic_functions_return_typedef: Fail
inference/generic_methods_infer_js_builtin: Fail
inference/infer_use_of_void: Fail
inference/list_literals_can_infer_null_top_level: Fail
inference/map_literals_can_infer_null_top_level: Fail
inference/property_set: Fail