Revert two Kernel changes that were causing test failures.

Example failure:
python tools/test.py -m release -c dartk --builder-tag no_ipv6 \
    language/function_type/function_type63_test

Revert "Serialize typedef parameters (including function typed ones) to Kernel and use it to resynthesize typedefs from Kernel."
This reverts commit afc392b66d.
Reverts https://codereview.chromium.org/2990783002

Revert "Add Member.documentationComment and use it to resynthesize documentation from Kernel."
This reverts commit 47ecf72272.
Reverts https://codereview.chromium.org/2990873002

Also reverts some attempts to fix test files:
302b410364
https://codereview.chromium.org/2984343002
05ccf27015
https://codereview.chromium.org/2992683002
f71dcd7834
https://codereview.chromium.org/2984363003

Also had to revert some test changes that were committed on top of a red buildbot, in order to try to get back to a place where bots were green:

23952fdf56
https://codereview.chromium.org/2990773002
557cab2a3e
https://codereview.chromium.org/2985173002

R=johnniwinther@google.com, karlklose@google.com
BUG=

Review-Url: https://codereview.chromium.org/2986093002 .
This commit is contained in:
Erik Corry 2017-07-28 14:08:19 +02:00
parent 56d58fe65e
commit e431e93e87
112 changed files with 2602 additions and 878 deletions

View file

@ -1683,11 +1683,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
@override
List<FunctionTypeAliasElement> get functionTypeAliases {
if (_kernelContext != null) {
_typeAliases ??= _kernelContext.library.typedefs
.map((k) => new FunctionTypeAliasElementImpl.forKernel(this, k))
.toList(growable: false);
}
if (_unlinkedUnit != null) {
_typeAliases ??= _unlinkedUnit.typedefs.map((t) {
if (t.style == TypedefStyle.functionType) {
@ -3974,9 +3969,6 @@ abstract class ExecutableElementImpl extends ElementImpl
@override
String get documentationComment {
if (_kernel != null) {
return _kernel.documentationComment;
}
if (serializedExecutable != null) {
return serializedExecutable?.documentationComment?.text;
}
@ -4928,11 +4920,6 @@ class FunctionTypeAliasElementImpl extends ElementImpl
*/
final UnlinkedTypedef _unlinkedTypedef;
/**
* The kernel of the element.
*/
final kernel.Typedef _kernel;
/**
* A list containing all of the parameters defined by this type alias.
*/
@ -4957,23 +4944,13 @@ class FunctionTypeAliasElementImpl extends ElementImpl
*/
FunctionTypeAliasElementImpl(String name, int nameOffset)
: _unlinkedTypedef = null,
_kernel = null,
super(name, nameOffset);
/**
* Initialize using the given kernel.
*/
FunctionTypeAliasElementImpl.forKernel(
CompilationUnitElementImpl enclosingUnit, this._kernel)
: _unlinkedTypedef = null,
super.forSerialized(enclosingUnit);
/**
* Initialize a newly created type alias element to have the given [name].
*/
FunctionTypeAliasElementImpl.forNode(Identifier name)
: _unlinkedTypedef = null,
_kernel = null,
super.forNode(name);
/**
@ -4981,8 +4958,7 @@ class FunctionTypeAliasElementImpl extends ElementImpl
*/
FunctionTypeAliasElementImpl.forSerialized(
this._unlinkedTypedef, CompilationUnitElementImpl enclosingUnit)
: _kernel = null,
super.forSerialized(enclosingUnit);
: super.forSerialized(enclosingUnit);
@override
int get codeLength {
@ -5023,7 +4999,7 @@ class FunctionTypeAliasElementImpl extends ElementImpl
_enclosingElement as CompilationUnitElementImpl;
@override
List<kernel.TypeParameter> get kernelTypeParams => _kernel?.typeParameters;
List<kernel.TypeParameter> get kernelTypeParams => null;
@override
ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
@ -5039,9 +5015,6 @@ class FunctionTypeAliasElementImpl extends ElementImpl
@override
String get name {
if (_kernel != null) {
return _kernel.name;
}
if (_unlinkedTypedef != null) {
return _unlinkedTypedef.name;
}
@ -5059,13 +5032,6 @@ class FunctionTypeAliasElementImpl extends ElementImpl
@override
List<ParameterElement> get parameters {
if (_kernel != null) {
_parameters ??= ParameterElementImpl.forKernelParameters(
this,
_kernel.requiredParameterCount,
_kernel.positionalParameters,
_kernel.namedParameters);
}
if (_unlinkedTypedef != null) {
_parameters ??= ParameterElementImpl.resynthesizeList(
_unlinkedTypedef.parameters, this);
@ -5088,17 +5054,10 @@ class FunctionTypeAliasElementImpl extends ElementImpl
@override
DartType get returnType {
if (_returnType == null) {
if (_kernel != null) {
var type = _kernel.type as kernel.FunctionType;
_returnType =
enclosingUnit._kernelContext.getType(this, type.returnType);
}
if (_unlinkedTypedef != null) {
_returnType = enclosingUnit.resynthesizerContext.resolveTypeRef(
this, _unlinkedTypedef.returnType,
declaredType: true);
}
if (_unlinkedTypedef != null && _returnType == null) {
_returnType = enclosingUnit.resynthesizerContext.resolveTypeRef(
this, _unlinkedTypedef.returnType,
declaredType: true);
}
return _returnType;
}
@ -5110,10 +5069,8 @@ class FunctionTypeAliasElementImpl extends ElementImpl
@override
FunctionType get type {
if (_type == null) {
if (_kernel != null || _unlinkedTypedef != null) {
_type = new FunctionTypeImpl.forTypedef(this);
}
if (_unlinkedTypedef != null && _type == null) {
_type = new FunctionTypeImpl.forTypedef(this);
}
return _type;
}
@ -7613,9 +7570,6 @@ abstract class NonParameterVariableElementImpl extends VariableElementImpl {
@override
String get documentationComment {
if (_kernel != null) {
return _kernel.documentationComment;
}
if (_unlinkedVariable != null) {
return _unlinkedVariable?.documentationComment?.text;
}

View file

@ -9435,13 +9435,6 @@ typedef dynamic F(dynamic x, dynamic y);
''');
}
test_typedef_parameters_named() async {
var library = await checkLibrary('typedef F({y, z, x});');
checkElementText(library, r'''
typedef dynamic F({dynamic y}, {dynamic z}, {dynamic x});
''');
}
test_typedef_return_type() async {
var library = await checkLibrary('typedef int F();');
checkElementText(library, r'''

View file

@ -307,6 +307,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_constExpr_pushReference_enum_method();
}
@failingTest
test_constructor_documented() async {
await super.test_constructor_documented();
}
@failingTest
test_constructor_initializers_assertInvocation() async {
await super.test_constructor_initializers_assertInvocation();
@ -478,6 +483,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_field_covariant();
}
@failingTest
test_field_documented() async {
await super.test_field_documented();
}
@failingTest
test_field_propagatedType_final_dep_inLib() async {
await super.test_field_propagatedType_final_dep_inLib();
@ -493,6 +503,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_field_propagatedType_final_noDep_instance();
}
@failingTest
test_function_documented() async {
await super.test_function_documented();
}
@failingTest
test_function_entry_point_in_export_hidden() async {
await super.test_function_entry_point_in_export_hidden();
@ -563,6 +578,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_getElement_unit();
}
@failingTest
test_getter_documented() async {
await super.test_getter_documented();
}
@failingTest
test_import_configurations_useDefault() async {
await super.test_import_configurations_useDefault();
@ -703,6 +723,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_library_documented_stars();
}
@failingTest
test_main_typedef() async {
await super.test_main_typedef();
}
@failingTest
test_metadata_classTypeAlias() async {
await super.test_metadata_classTypeAlias();
@ -775,6 +800,16 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_metadata_simpleFormalParameter_withDefault();
}
@failingTest
test_metadata_typeParameter_ofTypedef() async {
await super.test_metadata_typeParameter_ofTypedef();
}
@failingTest
test_method_documented() async {
await super.test_method_documented();
}
@failingTest
test_parameter_checked() async {
await super.test_parameter_checked();
@ -815,6 +850,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_setter_covariant();
}
@failingTest
test_setter_documented() async {
await super.test_setter_documented();
}
@failingTest
test_syntheticFunctionType_inGenericClass() async {
await super.test_syntheticFunctionType_inGenericClass();
@ -955,6 +995,61 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_typedef_generic_asFieldType();
}
@failingTest
test_typedef_parameter_parameters() async {
await super.test_typedef_parameter_parameters();
}
@failingTest
test_typedef_parameter_parameters_in_generic_class() async {
await super.test_typedef_parameter_parameters_in_generic_class();
}
@failingTest
test_typedef_parameter_return_type() async {
await super.test_typedef_parameter_return_type();
}
@failingTest
test_typedef_parameter_type() async {
await super.test_typedef_parameter_type();
}
@failingTest
test_typedef_parameter_type_generic() async {
await super.test_typedef_parameter_type_generic();
}
@failingTest
test_typedef_parameters() async {
await super.test_typedef_parameters();
}
@failingTest
test_typedef_return_type() async {
await super.test_typedef_return_type();
}
@failingTest
test_typedef_return_type_generic() async {
await super.test_typedef_return_type_generic();
}
@failingTest
test_typedef_return_type_implicit() async {
await super.test_typedef_return_type_implicit();
}
@failingTest
test_typedef_return_type_void() async {
await super.test_typedef_return_type_void();
}
@failingTest
test_typedef_type_parameters() async {
await super.test_typedef_type_parameters();
}
@failingTest
test_typedef_type_parameters_bound() async {
await super.test_typedef_type_parameters_bound();
@ -970,6 +1065,16 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_typedef_type_parameters_bound_recursive2();
}
@failingTest
test_typedef_type_parameters_f_bound_complex() async {
await super.test_typedef_type_parameters_f_bound_complex();
}
@failingTest
test_typedef_type_parameters_f_bound_simple() async {
await super.test_typedef_type_parameters_f_bound_simple();
}
@failingTest
@fastaProblem
test_unresolved_annotation_instanceCreation_argument_super() async {
@ -1075,6 +1180,11 @@ class ResynthesizeKernelStrongTest extends ResynthesizeTest {
await super.test_unresolved_part();
}
@failingTest
test_variable_documented() async {
await super.test_variable_documented();
}
@failingTest
test_variable_getterInLib_setterInPart() async {
await super.test_variable_getterInLib_setterInPart();

View file

@ -13,9 +13,9 @@ abstract class FieldBuilder<T> extends MemberBuilder {
final int modifiers;
FieldBuilder(String documentationComment, this.name, this.modifiers,
LibraryBuilder compilationUnit, int charOffset)
: super(compilationUnit, charOffset, documentationComment);
FieldBuilder(
this.name, this.modifiers, LibraryBuilder compilationUnit, int charOffset)
: super(compilationUnit, charOffset);
String get debugName => "FieldBuilder";

View file

@ -13,11 +13,9 @@ abstract class MemberBuilder extends ModifierBuilder {
/// library and updated later.
Builder parent;
String documentationComment;
String get name;
MemberBuilder(Builder parent, int charOffset, this.documentationComment)
MemberBuilder(Builder parent, int charOffset)
: parent = parent,
super(parent, charOffset);

View file

@ -34,7 +34,6 @@ abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder {
final List<FormalParameterBuilder> formals;
ProcedureBuilder(
String documentationComment,
this.metadata,
this.modifiers,
this.returnType,
@ -43,7 +42,7 @@ abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder {
this.formals,
LibraryBuilder compilationUnit,
int charOffset)
: super(compilationUnit, charOffset, documentationComment);
: super(compilationUnit, charOffset);
String get debugName => "ProcedureBuilder";

View file

@ -26,7 +26,7 @@ class DillMemberBuilder extends MemberBuilder {
DillMemberBuilder(Member member, Builder parent)
: modifiers = computeModifiers(member),
member = member,
super(parent, member.fileOffset, member.documentationComment);
super(parent, member.fileOffset);
String get debugName => "DillMemberBuilder";

View file

@ -125,10 +125,9 @@ class KernelEnumBuilder extends SourceClassBuilder
/// static const List<E> values = const <E>[id0, ..., idn-1];
/// String toString() => { 0: E.id0, . . ., n-1: E.idn-1}[index]
/// }
members["index"] = new KernelFieldBuilder(null, null, intType, "index",
finalMask, parent, charOffset, null, true);
members["index"] = new KernelFieldBuilder(
null, intType, "index", finalMask, parent, charOffset, null, true);
KernelConstructorBuilder constructorBuilder = new KernelConstructorBuilder(
null,
null,
constMask,
null,
@ -145,19 +144,10 @@ class KernelEnumBuilder extends SourceClassBuilder
constructors[""] = constructorBuilder;
int index = 0;
List<MapEntry> toStringEntries = <MapEntry>[];
KernelFieldBuilder valuesBuilder = new KernelFieldBuilder(
null,
null,
listType,
"values",
constMask | staticMask,
parent,
charOffset,
null,
true);
KernelFieldBuilder valuesBuilder = new KernelFieldBuilder(null, listType,
"values", constMask | staticMask, parent, charOffset, null, true);
members["values"] = valuesBuilder;
KernelProcedureBuilder toStringBuilder = new KernelProcedureBuilder(
null,
null,
0,
stringType,
@ -188,16 +178,8 @@ class KernelEnumBuilder extends SourceClassBuilder
constantNamesAndOffsets[i] = null;
continue;
}
KernelFieldBuilder fieldBuilder = new KernelFieldBuilder(
null,
null,
selfType,
name,
constMask | staticMask,
parent,
charOffset,
null,
true);
KernelFieldBuilder fieldBuilder = new KernelFieldBuilder(null, selfType,
name, constMask | staticMask, parent, charOffset, null, true);
members[name] = fieldBuilder;
toStringEntries.add(new MapEntry(
new IntLiteral(index), new StringLiteral("$className.$name")));

View file

@ -37,7 +37,6 @@ class KernelFieldBuilder extends FieldBuilder<Expression> {
final bool hasInitializer;
KernelFieldBuilder(
String documentationComment,
this.metadata,
this.type,
String name,
@ -48,8 +47,7 @@ class KernelFieldBuilder extends FieldBuilder<Expression> {
this.hasInitializer)
: field = new KernelField(null, fileUri: compilationUnit?.relativeFileUri)
..fileOffset = charOffset,
super(
documentationComment, name, modifiers, compilationUnit, charOffset);
super(name, modifiers, compilationUnit, charOffset);
void set initializer(Expression value) {
if (!hasInitializer && value is! NullLiteral && !isConst && !isFinal) {
@ -63,7 +61,6 @@ class KernelFieldBuilder extends FieldBuilder<Expression> {
type == null && (hasInitializer || isInstanceMember);
Field build(SourceLibraryBuilder library) {
field.documentationComment = documentationComment;
field.name ??= new Name(name, library.target);
if (type != null) {
field.type = type.build(library);

View file

@ -4,8 +4,6 @@
library fasta.kernel_function_type_alias_builder;
import 'package:front_end/src/fasta/kernel/kernel_function_type_builder.dart';
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
import 'package:kernel/ast.dart'
show
DartType,
@ -13,15 +11,15 @@ import 'package:kernel/ast.dart'
FunctionType,
InvalidType,
TypeParameter,
Typedef,
VariableDeclaration;
Typedef;
import 'package:kernel/type_algebra.dart' show substitute;
import '../fasta_codes.dart' show templateCyclicTypedef;
import 'kernel_builder.dart'
show
FunctionTypeAliasBuilder,
KernelFormalParameterBuilder,
KernelFunctionTypeBuilder,
KernelTypeBuilder,
KernelTypeVariableBuilder,
@ -63,7 +61,6 @@ class KernelFunctionTypeAliasBuilder
return thisType;
}
thisType = const InvalidType();
DartType builtType = type?.build(library) ?? const DynamicType();
if (typeVariables != null) {
for (KernelTypeVariableBuilder tv in typeVariables) {
@ -71,9 +68,6 @@ class KernelFunctionTypeAliasBuilder
target.typeParameters.add(tv.parameter..parent = target);
}
}
_buildParameters(library);
return thisType = builtType;
}
@ -109,23 +103,4 @@ class KernelFunctionTypeAliasBuilder
}
return buildTypesWithBuiltArguments(library, builtArguments);
}
/// Build and set formal parameters of this typedef.
void _buildParameters(LibraryBuilder library) {
int requiredCount = 0;
final positional = <VariableDeclaration>[];
final named = <VariableDeclaration>[];
if (type.formals != null) {
for (KernelFormalParameterBuilder formal in type.formals) {
KernelVariableDeclaration parameter = formal.build(library);
if (formal.isPositional) {
positional.add(parameter);
if (formal.isRequired) requiredCount++;
} else if (formal.isNamed) {
named.add(parameter);
}
}
target.setParameters(requiredCount, positional, named);
}
}
}

View file

@ -14,6 +14,7 @@ import 'package:kernel/ast.dart'
TypeParameter;
import '../fasta_codes.dart' show messageSupertypeIsFunction;
import 'kernel_builder.dart'
show
FormalParameterBuilder,

View file

@ -502,7 +502,6 @@ class KernelLibraryBuilder
@override
void addField(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder type,
@ -512,16 +511,8 @@ class KernelLibraryBuilder
bool hasInitializer) {
addBuilder(
name,
new KernelFieldBuilder(
documentationComment,
metadata,
type,
name,
modifiers,
this,
charOffset,
initializerTokenForInference,
hasInitializer),
new KernelFieldBuilder(metadata, type, name, modifiers, this,
charOffset, initializerTokenForInference, hasInitializer),
charOffset);
}
@ -550,7 +541,6 @@ class KernelLibraryBuilder
}
void addProcedure(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder returnType,
@ -572,7 +562,6 @@ class KernelLibraryBuilder
if (constructorName != null) {
name = constructorName;
procedure = new KernelConstructorBuilder(
documentationComment,
metadata,
modifiers & ~abstractMask,
returnType,
@ -586,7 +575,6 @@ class KernelLibraryBuilder
nativeMethodName);
} else {
procedure = new KernelProcedureBuilder(
documentationComment,
metadata,
modifiers,
returnType,
@ -608,7 +596,6 @@ class KernelLibraryBuilder
}
void addFactoryMethod(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
ConstructorReferenceBuilder constructorNameReference,
@ -631,7 +618,6 @@ class KernelLibraryBuilder
}
assert(constructorNameReference.suffix == null);
KernelProcedureBuilder procedure = new KernelProcedureBuilder(
documentationComment,
metadata,
staticMask | modifiers,
returnType,

View file

@ -81,7 +81,6 @@ abstract class KernelFunctionBuilder
Statement actualBody;
KernelFunctionBuilder(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder returnType,
@ -91,8 +90,8 @@ abstract class KernelFunctionBuilder
KernelLibraryBuilder compilationUnit,
int charOffset,
this.nativeMethodName)
: super(documentationComment, metadata, modifiers, returnType, name,
typeVariables, formals, compilationUnit, charOffset);
: super(metadata, modifiers, returnType, name, typeVariables, formals,
compilationUnit, charOffset);
void set body(Statement newBody) {
if (newBody != null) {
@ -208,7 +207,6 @@ class KernelProcedureBuilder extends KernelFunctionBuilder {
final ConstructorReferenceBuilder redirectionTarget;
KernelProcedureBuilder(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder returnType,
@ -226,17 +224,8 @@ class KernelProcedureBuilder extends KernelFunctionBuilder {
fileUri: compilationUnit?.relativeFileUri)
..fileOffset = charOffset
..fileEndOffset = charEndOffset,
super(
documentationComment,
metadata,
modifiers,
returnType,
name,
typeVariables,
formals,
compilationUnit,
charOffset,
nativeMethodName);
super(metadata, modifiers, returnType, name, typeVariables, formals,
compilationUnit, charOffset, nativeMethodName);
ProcedureKind get kind => procedure.kind;
@ -287,7 +276,6 @@ class KernelProcedureBuilder extends KernelFunctionBuilder {
procedure.isExternal = isExternal;
procedure.isConst = isConst;
procedure.name = new Name(name, library.target);
procedure.documentationComment = documentationComment;
}
if (isEligibleForTopLevelInference) {
library.loader.typeInferenceEngine.recordMember(procedure);
@ -322,7 +310,6 @@ class KernelConstructorBuilder extends KernelFunctionBuilder {
RedirectingInitializer redirectingInitializer;
KernelConstructorBuilder(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder returnType,
@ -337,17 +324,8 @@ class KernelConstructorBuilder extends KernelFunctionBuilder {
: constructor = new Constructor(null)
..fileOffset = charOffset
..fileEndOffset = charEndOffset,
super(
documentationComment,
metadata,
modifiers,
returnType,
name,
typeVariables,
formals,
compilationUnit,
charOffset,
nativeMethodName);
super(metadata, modifiers, returnType, name, typeVariables, formals,
compilationUnit, charOffset, nativeMethodName);
bool get isInstanceMember => false;
@ -370,7 +348,6 @@ class KernelConstructorBuilder extends KernelFunctionBuilder {
constructor.isConst = isConst;
constructor.isExternal = isExternal;
constructor.name = new Name(name, library.target);
constructor.documentationComment = documentationComment;
}
return constructor;
}

View file

@ -331,19 +331,8 @@ class KernelTarget extends TargetImplementation {
// method. Similarly considerations apply to separate compilation. It
// could also make sense to add a way to mark .dill files as having
// compile-time errors.
KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(
null,
null,
0,
null,
"main",
null,
null,
ProcedureKind.Method,
library,
-1,
-1,
-1);
KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0,
null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1);
library.addBuilder(mainBuilder.name, mainBuilder, -1);
mainBuilder.body = new Block(new List<Statement>.from(errors.map(
(LocatedMessage message) => new ExpressionStatement(new Throw(

View file

@ -328,10 +328,8 @@ class OutlineBuilder extends UnhandledListener {
int modifiers =
Modifier.validate(pop(), isAbstract: kind == MethodBody.Abstract);
List<MetadataBuilder> metadata = pop();
String documentationComment = _getDocumentationComment(beginToken);
checkEmpty(beginToken.charOffset);
library.addProcedure(
documentationComment,
metadata,
modifiers,
returnType,
@ -431,9 +429,7 @@ class OutlineBuilder extends UnhandledListener {
modifiers &= ~abstractMask;
}
List<MetadataBuilder> metadata = pop();
String documentationComment = _getDocumentationComment(beginToken);
library.addProcedure(
documentationComment,
metadata,
modifiers,
returnType,
@ -726,9 +722,7 @@ class OutlineBuilder extends UnhandledListener {
TypeBuilder type = pop();
int modifiers = Modifier.validate(pop());
List<MetadataBuilder> metadata = pop();
String documentationComment = _getDocumentationComment(beginToken);
library.addFields(
documentationComment, metadata, modifiers, type, fieldsInfo);
library.addFields(metadata, modifiers, type, fieldsInfo);
checkEmpty(beginToken.charOffset);
}
@ -739,9 +733,7 @@ class OutlineBuilder extends UnhandledListener {
TypeBuilder type = pop();
int modifiers = Modifier.validate(pop());
List<MetadataBuilder> metadata = pop();
String documentationComment = _getDocumentationComment(beginToken);
library.addFields(
documentationComment, metadata, modifiers, type, fieldsInfo);
library.addFields(metadata, modifiers, type, fieldsInfo);
}
@override
@ -801,9 +793,7 @@ class OutlineBuilder extends UnhandledListener {
var name = pop();
int modifiers = Modifier.validate(pop());
List<MetadataBuilder> metadata = pop();
String documentationComment = _getDocumentationComment(beginToken);
library.addFactoryMethod(
documentationComment,
metadata,
modifiers,
name,

View file

@ -219,7 +219,6 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
int charOffset);
void addField(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
T type,
@ -228,8 +227,8 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
Token initializerTokenForInference,
bool hasInitializer);
void addFields(String documentationComment, List<MetadataBuilder> metadata,
int modifiers, T type, List<Object> fieldsInfo) {
void addFields(List<MetadataBuilder> metadata, int modifiers, T type,
List<Object> fieldsInfo) {
for (int i = 0; i < fieldsInfo.length; i += 4) {
String name = fieldsInfo[i];
int charOffset = fieldsInfo[i + 1];
@ -240,13 +239,12 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
Token beforeLast = fieldsInfo[i + 3];
beforeLast.setNext(new Token.eof(beforeLast.next.offset));
}
addField(documentationComment, metadata, modifiers, type, name,
charOffset, initializerTokenForInference, hasInitializer);
addField(metadata, modifiers, type, name, charOffset,
initializerTokenForInference, hasInitializer);
}
}
void addProcedure(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
T returnType,
@ -277,7 +275,6 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
int charOffset);
void addFactoryMethod(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
ConstructorReferenceBuilder name,

View file

@ -493,16 +493,6 @@ class Typedef extends NamedNode {
List<Expression> annotations = const <Expression>[];
String name;
final List<TypeParameter> typeParameters;
@informative
int requiredParameterCount = 0;
@informative
List<VariableDeclaration> positionalParameters = <VariableDeclaration>[];
@informative
List<VariableDeclaration> namedParameters = <VariableDeclaration>[];
DartType type;
Typedef(this.name, this.type,
@ -518,22 +508,9 @@ class Typedef extends NamedNode {
return v.visitTypedef(this);
}
void setParameters(
int requiredParameterCount,
List<VariableDeclaration> positionalParameters,
List<VariableDeclaration> namedParameters) {
this.requiredParameterCount = requiredParameterCount;
this.positionalParameters = positionalParameters;
this.namedParameters = namedParameters;
setParents(this.positionalParameters, this);
setParents(this.namedParameters, this);
}
transformChildren(Transformer v) {
transformList(annotations, v, this);
transformList(typeParameters, v, this);
transformList(positionalParameters, v, this);
transformList(namedParameters, v, this);
if (type != null) {
type = v.visitDartType(type);
}
@ -542,9 +519,6 @@ class Typedef extends NamedNode {
visitChildren(Visitor v) {
visitList(annotations, v);
visitList(typeParameters, v);
visitList(typeParameters, v);
visitList(positionalParameters, v);
visitList(namedParameters, v);
type?.accept(v);
}
@ -860,10 +834,6 @@ abstract class Member extends NamedNode {
/// (this is the default if none is specifically set).
int fileEndOffset = TreeNode.noOffset;
/// Documentation comment of the member, or `null`.
@informative
String documentationComment;
/// List of metadata annotations on the member.
///
/// This defaults to an immutable empty list. Use [addAnnotation] to add

View file

@ -438,13 +438,6 @@ class BinaryBuilder {
String name = readStringReference();
String fileUri = readUriReference();
readAndPushTypeParameterList(node.typeParameters, node);
int requiredParameterCount = readUInt();
var positionalParameters = readVariableDeclarationList();
var namedParameters = readVariableDeclarationList();
node.setParameters(
requiredParameterCount, positionalParameters, namedParameters);
var type = readDartType();
typeParameterStack.length = 0;
if (shouldWriteData) {
@ -532,7 +525,6 @@ class BinaryBuilder {
readUInt(); // parent class binary offset.
var name = readName();
var fileUri = readUriReference();
var documentationComment = readStringOrNullIfEmpty();
var annotations = readAnnotationList(node);
debugPath.add(node.name?.name ?? 'field');
var type = readDartType();
@ -545,7 +537,6 @@ class BinaryBuilder {
node.flags = flags;
node.name = name;
node.fileUri = fileUri;
node.documentationComment = documentationComment;
node.annotations = annotations;
node.type = type;
node.initializer = initializer;
@ -570,7 +561,6 @@ class BinaryBuilder {
var flags = readByte();
readUInt(); // parent class binary offset.
var name = readName();
var documentationComment = readStringOrNullIfEmpty();
var annotations = readAnnotationList(node);
debugPath.add(node.name?.name ?? 'constructor');
var function = readFunctionNode();
@ -589,7 +579,6 @@ class BinaryBuilder {
node.fileEndOffset = fileEndOffset;
node.flags = flags;
node.name = name;
node.documentationComment = documentationComment;
node.annotations = annotations;
node.function = function..parent = node;
node.transformerFlags = transformerFlags;
@ -615,7 +604,6 @@ class BinaryBuilder {
readUInt(); // parent class binary offset.
var name = readName();
var fileUri = readUriReference();
var documentationComment = readStringOrNullIfEmpty();
var annotations = readAnnotationList(node);
debugPath.add(node.name?.name ?? 'procedure');
var function = readFunctionNodeOption();
@ -628,7 +616,6 @@ class BinaryBuilder {
node.flags = flags;
node.name = name;
node.fileUri = fileUri;
node.documentationComment = documentationComment;
node.annotations = annotations;
node.function = function;
node.function?.parent = node;
@ -1234,11 +1221,6 @@ class BinaryBuilder {
return new NamedExpression(readStringReference(), readExpression());
}
List<VariableDeclaration> readVariableDeclarationList() {
return new List<VariableDeclaration>.generate(
readUInt(), (i) => readVariableDeclaration());
}
List<VariableDeclaration> readAndPushVariableDeclarationList() {
return new List<VariableDeclaration>.generate(
readUInt(), (i) => readAndPushVariableDeclaration());

View file

@ -344,19 +344,14 @@ class BinaryPrinter extends Visitor {
}
void visitTypedef(Typedef node) {
_variableIndexer = new VariableIndexer();
writeCanonicalNameReference(getCanonicalNameOfTypedef(node));
writeOffset(node.fileOffset);
writeStringReference(node.name);
writeUriReference(node.fileUri ?? '');
_typeParameterIndexer.enter(node.typeParameters);
writeNodeList(node.typeParameters);
writeUInt30(node.requiredParameterCount);
writeVariableDeclarationList(node.positionalParameters);
writeVariableDeclarationList(node.namedParameters);
writeNode(node.type);
_typeParameterIndexer.exit(node.typeParameters);
_variableIndexer = null;
}
void writeAnnotation(Expression annotation) {
@ -420,7 +415,6 @@ class BinaryPrinter extends Visitor {
Class parent = node.parent;
writeUInt30(parent.binaryOffset);
writeName(node.name ?? _emptyName);
writeStringReference(node.documentationComment ?? '');
writeAnnotationList(node.annotations);
assert(node.function.typeParameters.isEmpty);
writeNode(node.function);
@ -450,7 +444,6 @@ class BinaryPrinter extends Visitor {
}
writeName(node.name ?? '');
writeUriReference(node.fileUri ?? '');
writeStringReference(node.documentationComment ?? '');
writeAnnotationList(node.annotations);
writeOptionalNode(node.function);
_variableIndexer = null;
@ -474,7 +467,6 @@ class BinaryPrinter extends Visitor {
}
writeName(node.name);
writeUriReference(node.fileUri ?? '');
writeStringReference(node.documentationComment ?? '');
writeAnnotationList(node.annotations);
writeNode(node.type);
writeOptionalNode(node.initializer);
@ -1378,29 +1370,11 @@ class StringIndexer extends RecursiveVisitor<Null> {
node.visitChildren(this);
}
@override
visitConstructor(Constructor node) {
putOptional(node.documentationComment);
super.visitConstructor(node);
}
@override
visitField(Field node) {
putOptional(node.documentationComment);
super.visitField(node);
}
visitNamedExpression(NamedExpression node) {
put(node.name);
node.visitChildren(this);
}
@override
visitProcedure(Procedure node) {
putOptional(node.documentationComment);
super.visitProcedure(node);
}
visitStringLiteral(StringLiteral node) {
put(node.value);
}

View file

@ -337,8 +337,7 @@ class VerifyingVisitor extends RecursiveVisitor {
!(parent is ForStatement && parent.body != node) &&
!(parent is ForInStatement && parent.body != node) &&
parent is! Let &&
parent is! LocalInitializer &&
parent is! Typedef) {
parent is! LocalInitializer) {
problem(
node,
"VariableDeclaration must be a direct child of a Block, "

View file

@ -4225,18 +4225,6 @@ void StreamingFlowGraphBuilder::SkipLibraryTypedef() {
SkipStringReference(); // read name index.
ReadUInt(); // read source_uri_index.
SkipTypeParametersList(); // read type parameters.
ReadUInt(); // read required parameter count
intptr_t positional_count = ReadListLength();
for (intptr_t i = 0; i < positional_count; i++) {
SkipVariableDeclaration();
}
intptr_t named_count = ReadListLength();
for (intptr_t i = 0; i < named_count; i++) {
SkipVariableDeclaration();
}
SkipDartType(); // read type.
}

View file

@ -860,7 +860,6 @@ class FieldHelper {
kParentClassBinaryOffset,
kName,
kSourceUriIndex,
kDocumentationCommentIndex,
kAnnotations,
kType,
kInitializer,
@ -920,9 +919,6 @@ class FieldHelper {
builder_->record_token_position(position_);
builder_->record_token_position(end_position_);
if (++next_read_ == field) return;
case kDocumentationCommentIndex:
builder_->ReadStringReference();
if (++next_read_ == field) return;
case kAnnotations: {
annotation_count_ = builder_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -1013,7 +1009,6 @@ class ProcedureHelper {
kParentClassBinaryOffset,
kName,
kSourceUriIndex,
kDocumentationCommentIndex,
kAnnotations,
kFunction,
kEnd
@ -1068,9 +1063,6 @@ class ProcedureHelper {
builder_->record_token_position(position_);
builder_->record_token_position(end_position_);
if (++next_read_ == field) return;
case kDocumentationCommentIndex:
builder_->ReadStringReference();
if (++next_read_ == field) return;
case kAnnotations: {
annotation_count_ = builder_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -1137,7 +1129,6 @@ class ConstructorHelper {
kFlags,
kParentClassBinaryOffset,
kName,
kDocumentationCommentIndex,
kAnnotations,
kFunction,
kInitializers,
@ -1183,9 +1174,6 @@ class ConstructorHelper {
case kName:
builder_->SkipName(); // read name.
if (++next_read_ == field) return;
case kDocumentationCommentIndex:
builder_->ReadStringReference();
if (++next_read_ == field) return;
case kAnnotations: {
annotation_count_ = builder_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {

View file

@ -1,6 +1,7 @@
// Copyright (c) 2015, 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.
// SharedOptions=--assert-message
import "package:expect/expect.dart";

View file

@ -0,0 +1,73 @@
// Copyright (c) 2012, 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.
// Dart test program to test arithmetic operations.
import "package:expect/expect.dart";
class A {
static foo() => 499;
}
bool throwsNoSuchMethod(f) {
try {
f();
return false;
} on NoSuchMethodError catch (e) {
return true;
}
return false;
}
bool throwsBecauseOfBadArgument(f) {
try {
f();
return false;
} on NoSuchMethodError catch (e) {
return true;
} on ArgumentError catch (e) {
return true;
} on TypeError catch (e) {
// In type checked mode.
return true;
}
return false;
}
numberOpBadSecondArgument(f) {
Expect.isTrue(throwsBecauseOfBadArgument(() => f(true)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(new A())));
Expect.isTrue(throwsBecauseOfBadArgument(() => f("foo")));
Expect.isTrue(throwsBecauseOfBadArgument(() => f("5")));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(() => 499)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(null)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(false)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f([])));
Expect.isTrue(throwsBecauseOfBadArgument(() => f({})));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(A.foo)));
}
badOperations(b) {
Expect.isTrue(throwsNoSuchMethod(() => b - 3));
Expect.isTrue(throwsNoSuchMethod(() => b * 3));
Expect.isTrue(throwsNoSuchMethod(() => b ~/ 3));
Expect.isTrue(throwsNoSuchMethod(() => b / 3));
Expect.isTrue(throwsNoSuchMethod(() => b % 3));
Expect.isTrue(throwsNoSuchMethod(() => b + 3));
Expect.isTrue(throwsNoSuchMethod(() => b[3]));
Expect.isTrue(throwsNoSuchMethod(() => ~b));
Expect.isTrue(throwsNoSuchMethod(() => -b));
}
main() {
numberOpBadSecondArgument((x) => 3 + x);
numberOpBadSecondArgument((x) => 3 - x);
numberOpBadSecondArgument((x) => 3 * x);
numberOpBadSecondArgument((x) => 3 / x);
numberOpBadSecondArgument((x) => 3 ~/ x);
numberOpBadSecondArgument((x) => 3 % x);
badOperations(true);
badOperations(false);
badOperations(() => 499);
badOperations(A.foo);
}

View file

@ -0,0 +1,228 @@
// Copyright (c) 2011, 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.
// VMOptions=--assert_initializer
import "package:expect/expect.dart";
bool assertsEnabled = false;
main() {
assert((assertsEnabled = true));
runtimeAsserts(); // //# none: ok
// Passing const expressions.
const c00 = const AssertArgument.constFirst(true, 0, 1);
const c01 = const AssertArgument.constLast(true, 0, 1);
const c02 = const AssertArgument.constMiddle(true, 0, 1);
const c03 = const AssertArgument.constMulti(true, 0, 1);
const c04 = const AssertArgument.constFirstSuper(true, 0, 1);
const c05 = const AssertArgument.constLastSuper(true, 0, 1);
const c06 = const AssertArgument.constMiddleSuper(true, 0, 1);
const c07 = const AssertArgument.constMultiSuper(true, 0, 1);
const c08 = const AssertCompare.constFirst(1, 2);
const c09 = const AssertCompare.constLast(1, 2);
const c10 = const AssertCompare.constMiddle(1, 2);
const c11 = const AssertCompare.constMulti(1, 2);
const c12 = const AssertCompare.constFirstSuper(1, 2);
const c13 = const AssertCompare.constLastSuper(1, 2);
const c14 = const AssertCompare.constMiddleSuper(1, 2);
const c15 = const AssertCompare.constMultiSuper(1, 2);
// Failing const expressions
const c = const AssertArgument.constFirst(false, 0, 1); // //# 01: checked mode compile-time error
const c = const AssertArgument.constLast(false, 0, 1); // //# 02: checked mode compile-time error
const c = const AssertArgument.constMiddle(false, 0, 1); // //# 03: checked mode compile-time error
const c = const AssertArgument.constMulti(false, 0, 1); // //# 04: checked mode compile-time error
const c = const AssertArgument.constFirstSuper(false, 0, 1); // //# 05: checked mode compile-time error
const c = const AssertArgument.constLastSuper(false, 0, 1); // //# 06: checked mode compile-time error
const c = const AssertArgument.constMiddleSuper(false, 0, 1); // //# 07: checked mode compile-time error
const c = const AssertArgument.constMultiSuper(false, 0, 1); // //# 08: checked mode compile-time error
const c = const AssertArgument.constFirst("str", 0, 1); // //# 11: checked mode compile-time error
const c = const AssertArgument.constLast("str", 0, 1); // //# 12: checked mode compile-time error
const c = const AssertArgument.constMiddle("str", 0, 1); // //# 13: checked mode compile-time error
const c = const AssertArgument.constMulti("str", 0, 1); // //# 14: checked mode compile-time error
const c = const AssertArgument.constFirstSuper("str", 0, 1); // //# 15: checked mode compile-time error
const c = const AssertArgument.constLastSuper("str", 0, 1); // //# 16: checked mode compile-time error
const c = const AssertArgument.constMiddleSuper("str", 0, 1); // //# 17: checked mode compile-time error
const c = const AssertArgument.constMultiSuper("str", 0, 1); // //# 18: checked mode compile-time error
const c = const AssertCompare.constFirst(3, 2); // //# 21: checked mode compile-time error
const c = const AssertCompare.constLast(3, 2); // //# 22: checked mode compile-time error
const c = const AssertCompare.constMiddle(3, 2); // //# 23: checked mode compile-time error
const c = const AssertCompare.constMulti(3, 2); // //# 24: checked mode compile-time error
const c = const AssertCompare.constFirstSuper(3, 2); // //# 25: checked mode compile-time error
const c = const AssertCompare.constLastSuper(3, 2); // //# 26: checked mode compile-time error
const c = const AssertCompare.constMiddleSuper(3, 2); // //# 27: checked mode compile-time error
const c = const AssertCompare.constMultiSuper(3, 2); // //# 28: checked mode compile-time error
// Functions not allowed in asserts in const execution.
const c = const AssertArgument.constFirst(kTrue, 0, 1); // //# 31: checked mode compile-time error
const c = const AssertArgument.constLast(kTrue, 0, 1); // //# 32: checked mode compile-time error
const c = const AssertArgument.constMiddle(kTrue, 0, 1); // //# 33: checked mode compile-time error
const c = const AssertArgument.constMulti(kTrue, 0, 1); // //# 34: checked mode compile-time error
const c = const AssertArgument.constFirstSuper(kTrue, 0, 1); // //# 35: checked mode compile-time error
const c = const AssertArgument.constLastSuper(kTrue, 0, 1); // //# 36: checked mode compile-time error
const c = const AssertArgument.constMiddleSuper(kTrue, 0, 1); // //# 37: checked mode compile-time error
const c = const AssertArgument.constMultiSuper(kTrue, 0, 1); // //# 38: checked mode compile-time error
const cTrue = const TrickCompare(true);
// Value must be integer for potential-const expression to be actually const.
const c = const AssertCompare.constFirst(cTrue, 2); // //# 41: checked mode compile-time error
const c = const AssertCompare.constLast(cTrue, 2); // //# 42: checked mode compile-time error
const c = const AssertCompare.constMiddle(cTrue, 2); // //# 43: checked mode compile-time error
const c = const AssertCompare.constMulti(cTrue, 2); // //# 44: checked mode compile-time error
const c = const AssertCompare.constFirstSuper(cTrue, 2); // //# 45: checked mode compile-time error
const c = const AssertCompare.constLastSuper(cTrue, 2); // //# 46: checked mode compile-time error
const c = const AssertCompare.constMiddleSuper(cTrue, 2); // //# 47: checked mode compile-time error
const c = const AssertCompare.constMultiSuper(cTrue, 2); // //# 48: checked mode compile-time error
}
void runtimeAsserts() {
testAssertArgumentCombinations(value, test, [testConst]) {
test(() => new AssertArgument.first(value, 0, 1));
test(() => new AssertArgument.last(value, 0, 1));
test(() => new AssertArgument.middle(value, 0, 1));
test(() => new AssertArgument.multi(value, 0, 1));
test(() => new AssertArgument.firstSuper(value, 0, 1));
test(() => new AssertArgument.lastSuper(value, 0, 1));
test(() => new AssertArgument.middleSuper(value, 0, 1));
test(() => new AssertArgument.multiSuper(value, 0, 1));
testConst ??= test;
testConst(() => new AssertArgument.constFirst(value, 0, 1));
testConst(() => new AssertArgument.constLast(value, 0, 1));
testConst(() => new AssertArgument.constMiddle(value, 0, 1));
testConst(() => new AssertArgument.constMulti(value, 0, 1));
testConst(() => new AssertArgument.constFirstSuper(value, 0, 1));
testConst(() => new AssertArgument.constLastSuper(value, 0, 1));
testConst(() => new AssertArgument.constMiddleSuper(value, 0, 1));
testConst(() => new AssertArgument.constMultiSuper(value, 0, 1));
}
testAssertCompareCombinations(v1, v2, test, [testConst]) {
test(() => new AssertCompare.first(v1, v2));
test(() => new AssertCompare.last(v1, v2));
test(() => new AssertCompare.middle(v1, v2));
test(() => new AssertCompare.multi(v1, v2));
test(() => new AssertCompare.firstSuper(v1, v2));
test(() => new AssertCompare.lastSuper(v1, v2));
test(() => new AssertCompare.middleSuper(v1, v2));
test(() => new AssertCompare.multiSuper(v1, v2));
testConst ??= test;
testConst(() => new AssertCompare.constFirst(v1, v2));
testConst(() => new AssertCompare.constLast(v1, v2));
testConst(() => new AssertCompare.constMiddle(v1, v2));
testConst(() => new AssertCompare.constMulti(v1, v2));
testConst(() => new AssertCompare.constFirstSuper(v1, v2));
testConst(() => new AssertCompare.constLastSuper(v1, v2));
testConst(() => new AssertCompare.constMiddleSuper(v1, v2));
testConst(() => new AssertCompare.constMultiSuper(v1, v2));
}
testAssertArgumentCombinations(true, pass);
testAssertArgumentCombinations(kTrue, pass, failType);
testAssertArgumentCombinations(false, failAssert);
testAssertArgumentCombinations(kFalse, failAssert, failType);
testAssertArgumentCombinations(42, failType);
testAssertArgumentCombinations(null, failAssert);
testAssertCompareCombinations(1, 2, pass);
testAssertCompareCombinations(3, 2, failAssert);
var TrickCompareInt = const TrickCompare(42);
testAssertCompareCombinations(TrickCompareInt, 0, failType);
var TrickCompareTrueFun = const TrickCompare(kTrue);
testAssertCompareCombinations(TrickCompareTrueFun, 0, pass, failType);
var TrickCompareFalseFun = const TrickCompare(kFalse);
testAssertCompareCombinations(TrickCompareFalseFun, 0, failAssert, failType);
}
void pass(void action()) {
action();
}
void failAssert(void action()) {
if (assertsEnabled) {
Expect.throws(action, (e) => e is AssertionError && e is! TypeError);
} else {
action();
}
}
void failType(void action()) {
if (assertsEnabled) {
Expect.throws(action, (e) => e is TypeError);
} else {
action();
}
}
bool kTrue() => true;
bool kFalse() => false;
class AssertArgument {
final y;
final z;
AssertArgument.first(x, y, z) : assert(x), y = y, z = z;
AssertArgument.last(x, y, z) : y = y, z = z, assert(x);
AssertArgument.middle(x, y, z) : y = y, assert(x), z = z;
AssertArgument.multi(x, y, z)
: assert(x), y = y, assert(x), z = z, assert(x);
AssertArgument.firstSuper(x, y, z) : assert(x), y = y, z = z, super();
AssertArgument.lastSuper(x, y, z) : y = y, z = z, assert(x), super();
AssertArgument.middleSuper(x, y, z) : y = y, assert(x), z = z, super();
AssertArgument.multiSuper(x, y, z)
: assert(x), y = y, assert(x), z = z, assert(x), super();
const AssertArgument.constFirst(x, y, z) : assert(x), y = y, z = z;
const AssertArgument.constLast(x, y, z) : y = y, z = z, assert(x);
const AssertArgument.constMiddle(x, y, z) : y = y, assert(x), z = z;
const AssertArgument.constMulti(x, y, z)
: assert(x), y = y, assert(x), z = z, assert(x);
const AssertArgument.constFirstSuper(x, y, z)
: assert(x), y = y, z = z, super();
const AssertArgument.constLastSuper(x, y, z)
: y = y, z = z, assert(x), super();
const AssertArgument.constMiddleSuper(x, y, z)
: y = y, assert(x), z = z, super();
const AssertArgument.constMultiSuper(x, y, z)
: assert(x), y = y, assert(x), z = z, assert(x), super();
}
class AssertCompare {
final y;
final z;
AssertCompare.first(y, z) : assert(y < z), y = y, z = z;
AssertCompare.last(y, z) : y = y, z = z, assert(y < z);
AssertCompare.middle(y, z) : y = y, assert(y < z), z = z;
AssertCompare.multi(y, z)
: assert(y < z), y = y, assert(y < z), z = z, assert(y < z);
AssertCompare.firstSuper(y, z) : assert(y < z), y = y, z = z, super();
AssertCompare.lastSuper(y, z) : y = y, z = z, assert(y < z), super();
AssertCompare.middleSuper(y, z) : y = y, assert(y < z), z = z, super();
AssertCompare.multiSuper(y, z)
: assert(y < z), y = y, assert(y < z), z = z, assert(y < z), super();
const AssertCompare.constFirst(y, z) : assert(y < z), y = y, z = z;
const AssertCompare.constLast(y, z) : y = y, z = z, assert(y < z);
const AssertCompare.constMiddle(y, z) : y = y, assert(y < z), z = z;
const AssertCompare.constMulti(y, z)
: assert(y < z), y = y, assert(y < z), z = z, assert(y < z);
const AssertCompare.constFirstSuper(y, z)
: assert(y < z), y = y, z = z, super();
const AssertCompare.constLastSuper(y, z)
: y = y, z = z, assert(y < z), super();
const AssertCompare.constMiddleSuper(y, z)
: y = y, assert(y < z), z = z, super();
const AssertCompare.constMultiSuper(y, z)
: assert(y < z), y = y, assert(y < z), z = z, assert(y < z), super();
}
class TrickCompare {
final result;
const TrickCompare(this.result);
operator<(other) => result; // Nyah-nyah!
}

View file

@ -2,13 +2,13 @@
// 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.
// SharedOptions=--assert-message
import "dart:async";
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
// TODO(rnystrom): Unify with assert_with_message_test.dart.
main() {
// Only run with asserts enabled mode.
bool assertsEnabled = false;

View file

@ -85,10 +85,10 @@ main() {
}
void test(int x, int y) {
bool assertionsEnabled = false;
assert(assertionsEnabled = true);
bool checkedMode = false;
assert(checkedMode = true);
bool Function(C Function()) doTest = (assertionsEnabled && x >= y)
bool Function(C Function()) doTest = (checkedMode && x >= y)
? (f) { Expect.throws(f, (e) => e is AssertionError); }
: (f) { Expect.equals(x, f().x); };

View file

@ -0,0 +1,77 @@
// Copyright (c) 2011, 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.
// VMOptions=--enable_asserts
//
// Dart test program testing assert statements.
import "package:expect/expect.dart";
class AssertionTest {
static testTrue() {
int i = 0;
try {
assert(true);
} on AssertionError catch (error) {
i = 1;
}
return i;
}
static testFalse() {
int i = 0;
try {
assert(false);
} on AssertionError catch (error) {
i = 1;
}
return i;
}
static unknown(var a) {
return (a) ? true : false;
}
static testUnknown() {
var x = unknown(false);
int i = 0;
try {
assert(x);
} on AssertionError catch (error) {
i = 1;
}
return i;
}
static testClosure() {
int i = 0;
try {
assert(() => false);
} on AssertionError catch (error) {
i = 1;
}
return i;
}
static testClosure2() {
int i = 0;
try {
var x = () => false;
assert(x);
} on AssertionError catch (error) {
i = 1;
}
return i;
}
static testMain() {
Expect.equals(0, testTrue());
Expect.equals(1, testFalse());
Expect.equals(1, testClosure());
Expect.equals(1, testClosure2());
}
}
main() {
AssertionTest.testMain();
}

View file

@ -2,8 +2,6 @@
// 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.
import 'package:expect/expect.dart';
class A {
A() {}
imethod() {
@ -12,12 +10,9 @@ class A {
}
main() {
dynamic a = new A();
// Illegal, can't change a member method.
Expect.throws(() {
a.imethod = () {
return 1;
};
});
var a = new A();
// Illegal, can't change a member method
a.imethod = () {
return 1;
};
}

View file

@ -0,0 +1,33 @@
// Copyright (c) 2012, 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.
// This test insures that statically initialized variables, fields, and parameters
// report static type warnings.
int a = "String"; // //# 01: static type warning, dynamic type error
class A {
static const int c = "String"; //# 02: static type warning, checked mode compile-time error
final int d = "String"; //# 03: static type warning, dynamic type error
int e = "String"; //# 04: static type warning, dynamic type error
A() {
int f = "String"; //# 05: static type warning, dynamic type error
}
method(
[
int // //# 06: static type warning
g = "String"]) {
return g;
}
}
int main() {
var w = a; //# 01: continued
var x;
x = A.c; // //# 02: continued
var v = new A();
x = v.d; // //# 03: continued
x = v.e; // //# 04: continued
x = v.method(1); //# 06: continued
}

View file

@ -0,0 +1,29 @@
// Copyright (c) 2015, 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.
// Verify that an attempt to assign to a class, enum, typedef, or type
// parameter produces a static warning and runtime error.
import "package:expect/expect.dart";
noMethod(e) => e is NoSuchMethodError;
class C<T> {
f() {
Expect.throws(() => T = null, noMethod); //# 01: static type warning
}
}
class D {}
enum E { e0 }
typedef void F();
main() {
new C<D>().f();
Expect.throws(() => D = null, noMethod); //# 02: static type warning
Expect.throws(() => E = null, noMethod); //# 03: static type warning
Expect.throws(() => F = null, noMethod); //# 04: static type warning
}

View file

@ -0,0 +1,15 @@
// Copyright (c) 2012, 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.
import "package:expect/expect.dart";
method() {
return 0;
}
main() {
// Illegal, can't change a top level method
Expect.throws(() { method = () { return 1; }; }, // //# 01: static type warning
(e) => e is NoSuchMethodError); // //# 01: continued
}

View file

@ -0,0 +1,44 @@
// Copyright (c) 2013, 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.
// Test to detect syntactically illegal left-hand-side (assignable)
// expressions.
class C {
static var static_field = 0;
}
var tl_static_var = 0;
main() {
tl_static_var = 0;
(tl_static_var) = 0; // //# 01: compile-time error
(tl_static_var)++; // //# 02: compile-time error
++(tl_static_var); // //# 03: compile-time error
C.static_field = 0;
(C.static_field) = 0; // //# 11: compile-time error
(C.static_field)++; // //# 12: compile-time error
++(C.static_field); // //# 13: compile-time error
tl_static_var = [1, 2, 3];
tl_static_var[0] = 0;
(tl_static_var)[0] = 0;
(tl_static_var[0]) = 0; // //# 21: compile-time error
(tl_static_var[0])++; // //# 22: compile-time error
++(tl_static_var[0]); // //# 23: compile-time error
C.static_field = [1, 2, 3];
(C.static_field[0]) = 0; // //# 31: compile-time error
(C.static_field[0])++; // //# 32: compile-time error
++(C.static_field[0]); // //# 33: compile-time error
var a = 0;
(a) = 0; // //# 41: compile-time error
(a)++; // //# 42: compile-time error
++(a); // //# 43: compile-time error
// Neat palindrome expression. x is assignable, ((x)) is not.
var funcnuf = (x) => ((x))=((x)) <= (x); // //# 50: compile-time error
}

View file

@ -54,7 +54,7 @@ a07b() sync { yield 0; } // //# a07b: compile-time error
a08a() sync* { yield* []; } // //# a08a: ok
a08b() sync { yield 0; } // //# a08b: compile-time error
a09a() async* { yield 0; } // //# a09a: ok
a10a() async* { yield* []; } // //# a10a: compile-time error
a10a() async* { yield* []; } // //# a10a: static type warning
get sync sync {} // //# a11a: compile-time error
get sync sync* {} // //# a11b: ok
@ -122,7 +122,7 @@ class C extends B {
b07a() sync* { yield 0; } // //# b07a: ok
b08a() sync* { yield* []; } // //# b08a: ok
b09a() async* { yield 0; } // //# b09a: ok
b10a() async* { yield* []; } // //# b10a: compile-time error
b10a() async* { yield* []; } // //# b10a: static type warning
b10b() async { yield 0; } // //# b10b: compile-time error
get sync sync {} // //# b11a: compile-time error
@ -167,7 +167,7 @@ method1() {
c07a() sync* { yield 0; } c07a(); // //# c07a: ok
c08a() sync* { yield* []; } c08a(); // //# c08a: ok
c09a() async* { yield 0; } c09a(); // //# c09a: ok
c10a() async* { yield* []; } c10a(); // //# c10a: compile-time error
c10a() async* { yield* []; } c10a(); // //# c10a: static type warning
c11a() async { yield -5; } c11a(); // //# c11a: compile-time error
c11b() async { yield* st; } c11b(); // //# c11b: compile-time error
}
@ -184,10 +184,10 @@ method2() {
var d06a = () async { await for (var o in st) {} }; d06a(); // //# d06a: ok
var d07a = () sync* { yield 0; }; d07a(); // //# d07a: ok
var d08a = () sync* { yield* []; }; d08a(); // //# d08a: ok
var d08b = () sync* { yield*0+1; }; d08b(); // //# d08b: compile-time error
var d08b = () sync* { yield*0+1; }; d08b(); // //# d08b: static type warning
var d08c = () { yield*0+1; }; d08c(); // //# d08c: ok
var d09a = () async* { yield 0; }; d09a(); // //# d09a: ok
var d10a = () async* { yield* []; }; d10a(); // //# d10a: compile-time error
var d10a = () async* { yield* []; }; d10a(); // //# d10a: static type warning
}
void main() {

View file

@ -0,0 +1,35 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
void badReturnTypeAsync() async {} // //# 01: static type warning
void badReturnTypeAsyncStar() async* {} // //# 02: static type warning
void badReturnTypeSyncStar() sync* {} // //# 03: static type warning
main() {
try {
badReturnTypeAsync(); // //# 01: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeAsync"), "missing frame");
}
try {
badReturnTypeAsyncStar(); // //# 02: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeAsyncStar"), "missing frame");
}
try {
badReturnTypeSyncStar(); // //# 03: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeSyncStar"), "missing frame");
}
}

View file

@ -14,17 +14,18 @@ Future<int> foo2() async {
return 3;
}
Future<int> //# wrongTypeParameter: compile-time error
Future<int> //# wrongTypeParameter: static type warning, dynamic type error
foo3() async {
return "String";
}
Future<int, String> //# tooManyTypeParameters: compile-time error
// Future<int, String> is treated like Future<dynamic>
Future<int, String> //# tooManyTypeParameters: static type warning
foo4() async {
return "String";
}
int //# wrongReturnType: compile-time error
int //# wrongReturnType: static type warning, dynamic type error
foo5() async {
return 3;
}
@ -34,7 +35,7 @@ Future<int> foo6() async {
return new Future<int>.value(3);
}
Future<Future<int>> //# nestedFuture: compile-time error
Future<Future<int>> //# nestedFuture: static type warning, dynamic type error
foo7() async {
return new Future<int>.value(3);
}

View file

@ -4,13 +4,11 @@
library async_star_pause_test;
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
import "package:unittest/unittest.dart";
import "dart:async";
main() {
// await for pauses stream during body.
asyncTest(() async {
test("await for pauses stream during body", () async {
// Assumes await-for uses streamIterator.
var log = [];
var s = () async* {
@ -26,7 +24,7 @@ main() {
await nextMicrotask();
log.add("$i!");
}
Expect.listEquals(log, [
expect(log, [
"0-",
"0?",
"0!",

View file

@ -11,11 +11,53 @@
[$compiler == precompiler && $runtime == dart_precompiled ]
stacktrace_demangle_ctors_test: RuntimeError
[$compiler == precompiler && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error2_test/cc01: Pass, OK
assertion_initializer_const_error2_test/cc02: CompileTimeError
assertion_initializer_const_error2_test/cc03: Pass, OK
assertion_initializer_const_error2_test/cc04: Pass, OK
assertion_initializer_const_error2_test/cc05: Pass, OK
assertion_initializer_const_error2_test/cc06: Pass, OK
assertion_initializer_const_error2_test/cc07: Pass, OK
assertion_initializer_const_error2_test/cc08: Pass, OK
assertion_initializer_const_error2_test/cc09: Pass, OK
assertion_initializer_const_error2_test/cc10: Pass, OK
assertion_initializer_const_error2_test/cc11: Pass, OK
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == precompiler && $runtime == dart_precompiled && $checked]
assertion_initializer_const_error2_test/cc01: Pass
assertion_initializer_const_error2_test/cc03: Pass
assertion_initializer_const_error2_test/cc04: Pass
assertion_initializer_const_error2_test/cc05: Pass
assertion_initializer_const_error2_test/cc06: Pass
assertion_initializer_const_error2_test/cc07: Pass
assertion_initializer_const_error2_test/cc08: Pass
assertion_initializer_const_error2_test/cc09: Pass
assertion_initializer_const_error2_test/cc10: Pass
assertion_initializer_const_error2_test/cc11: Pass
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == none && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[$compiler == app_jit && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[ ($runtime == vm || $runtime == flutter || $runtime == dart_precompiled) && $compiler != dartk && $compiler != dartkp ]
abstract_beats_arguments2_test/01: Crash # Issue 29171
[ $runtime == vm || $runtime == dart_precompiled ]
# These test entries will be valid for vm (with and without kernel).
[ $compiler == none || $compiler == app_jit || $compiler == dartk || $runtime == dart_precompiled ]
async_star_cancel_while_paused_test: RuntimeError
# This is OK for now, but we may want to change the semantics to match the test.
async_star_pause_test: Fail, OK
# These tests are skipped in the VM because it has "--supermixin"
# functionality enabled unconditionally. The tests should be removed
@ -60,6 +102,8 @@ multiline_strings_test: Fail # Issue 23020
deferred_redirecting_factory_test: Fail, Crash # Issue 23408
redirecting_constructor_initializer_test: RuntimeError # Issue 23488
async_star_regression_2238_test: CompileTimeError, RuntimeError
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $checked ]
# These generic functions tests pass for the wrong reason in checked mode,
# because the parsed type parameters are mapped to dynamic type.
@ -97,11 +141,27 @@ vm/unaligned_float_access_literal_index_test: Pass, Crash # Unaligned offset. Is
vm/regress_24517_test: Pass, Fail # Issue 24517.
[ $compiler == precompiler && $runtime == dart_precompiled ]
assertion_initializer_const_error2_test/cc01: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc02: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc03: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc04: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc05: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc06: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc07: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc08: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc09: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc10: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc11: Crash, MissingCompileTimeError
vm/regress_27671_test: Skip # Unsupported
export_double_same_main_test: Skip # Issue 29895
export_ambiguous_main_negative_test: Skip # Issue 29895
vm/optimized_stacktrace_test: Skip # Issue 30198
[ $compiler == precompiler && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[ $compiler == precompiler && $runtime == dart_precompiled && $mode == debug ]
regress_29025_test: Crash # Issue dartbug.com/29331
@ -163,6 +223,7 @@ vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
[ $mode == product ]
issue13474_test: SkipByDesign # Requires checked mode.
assertion_test: SkipByDesign # Requires checked mode.
named_parameters_type_test/01: SkipByDesign # Requires checked mode.
named_parameters_type_test/02: SkipByDesign # Requires checked mode.
named_parameters_type_test/03: SkipByDesign # Requires checked mode.
@ -237,6 +298,14 @@ conditional_import_string_test: Crash # Requires deferred libraries
vm/regress_27201_test: Pass, Crash # Requires deferred libraries
vm/optimized_stacktrace_test: Pass, Slow
[ ($runtime != vm && $compiler != dartk && $compiler != dartkp ) || ($compiler != none && $compiler != dartk && $compiler != dartkp )]
assert_initializer_test/*: SKIP # not implemented yet, experiment is VM only.
[($runtime == vm || $runtime == flutter) && $compiler == none && $checked]
# The VM doesn't enforce that potentially const expressions are actually
# const expressions when the constructor is called with `const`.
assert_initializer_test/4*: MissingCompileTimeError # Issue 392.
[($runtime == vm || $runtime == flutter) && $compiler == none]
duplicate_part_test/01: MissingCompileTimeError # Issue 27516
@ -269,6 +338,9 @@ syntax_test/none: CompileTimeError # Issue #30176.
await_backwards_compatibility_test/none: CompileTimeError
await_test: CompileTimeError
async_await_test: CompileTimeError
async_await_syntax_test/a05c: CompileTimeError
async_await_syntax_test/a05e: CompileTimeError
async_await_syntax_test/d08c: CompileTimeError
static_initializer_type_error_test: CompileTimeError
new_expression_type_args_test/02: CompileTimeError
super_getter_setter_test: CompileTimeError
@ -346,6 +418,7 @@ override_inheritance_method_test/30: CompileTimeError
redirecting_factory_reflection_test: CompileTimeError
method_override6_test: CompileTimeError
try_catch_syntax_test/08: CompileTimeError
async_return_types_test/tooManyTypeParameters: CompileTimeError
method_override4_test: CompileTimeError
super_call4_test: CompileTimeError
wrong_number_type_arguments_test/00: CompileTimeError
@ -493,7 +566,13 @@ deferred_global_test: Skip # Timeout
config_import_test: RuntimeError # Flutter Issue 9110
vm/no_such_method_error_message_callable_vm_test: RuntimeError # Flutter Issue 9110
vm/regress_27201_test: Fail # Flutter Issue 9110
async_return_types_test/nestedFuture: Skip # Flutter Issue 9110
async_return_types_test/wrongTypeParameter: Skip # Flutter Issue 9110
async_return_types_test/wrongReturnType: Skip # Flutter Issue 9110
async_return_types_test/return_value_sync_star: Skip # Flutter Issue 9110
asyncstar_yield_test: Skip # Flutter Issue 9110
async_star_no_cancel_test: Skip # Flutter Issue 9110
async_star_cancel_while_paused_test: Skip # Flutter Issue 9110
await_for_test: Skip # Flutter Issue 9110
await_for_cancel_test: Skip # Flutter Issue 9110

View file

@ -453,3 +453,8 @@ part_refers_to_core_library_test/01: MissingCompileTimeError # Issue 29709
[ $compiler == dart2analyzer && $builder_tag == strong ]
*: Skip # Issue 28649
[$compiler == dart2analyzer && $runtime == none]
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_test/01: CompileTimeError
assertion_initializer_test: CompileTimeError

View file

@ -7,6 +7,7 @@
vm/*: Skip # Issue 12699
[ $compiler == dart2js && ! $dart2js_with_kernel ]
assert_trailing_comma_test/none: CompileTimeError # Issue 29959
enum_test: Fail # Issue 28340
regress_28341_test: Fail # Issue 28340
regress_29349_test: CompileTimeError # Issue 29745
@ -16,6 +17,8 @@ getter_setter_in_lib_test: Fail # Issue 23288
method_name_test: Fail # issue 25574
setter4_test: CompileTimeError # issue 13639
async_star_cancel_while_paused_test: RuntimeError # Issue 22853
try_catch_on_syntax_test/10: Fail # Issue 19823
try_catch_on_syntax_test/11: Fail # Issue 19823
@ -47,6 +50,19 @@ generic_function_typedef2_test/06: Crash # Issue 28214
stacktrace_demangle_ctors_test: Fail # dart2js stack traces are not always compliant.
assertion_initializer_const_error2_test/cc01: Crash
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error2_test/cc03: Crash
assertion_initializer_const_error2_test/cc04: Crash
assertion_initializer_const_error2_test/cc05: Crash
assertion_initializer_const_error2_test/cc06: Crash
assertion_initializer_const_error2_test/cc07: Crash
assertion_initializer_const_error2_test/cc08: Crash
assertion_initializer_const_error2_test/cc09: Crash
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_const_function_test/01: CompileTimeError
assertion_initializer_test: Crash
generalized_void_syntax_test: CompileTimeError # Issue #30176.
syntax_test/none: CompileTimeError # Issue #30176.
@ -82,6 +98,8 @@ vm/reflect_core_vm_test: Fail # mirrors not supported
await_for_test: Skip # Jsshell does not provide periodic timers, Issue 7728
async_star_test: RuntimeError # Jsshell does not provide non-zero timers, Issue 7728
regress_23996_test: RuntimeError # Jsshell does not provide non-zero timers, Issue 7728
async_star_no_cancel_test: RuntimeError # Need triage
async_star_no_cancel2_test: RuntimeError # Need triage
[ $compiler == dart2js && $browser && ! $dart2js_with_kernel ]
config_import_test: Fail # Test flag is not passed to the compiler.
@ -151,6 +169,8 @@ multiline_newline_test/06r: MissingCompileTimeError # Issue 23888
mixin_mixin_type_arguments_test: RuntimeError # Issue 29587
[ $compiler == dart2js && $checked && ! $dart2js_with_kernel ]
async_return_types_test/nestedFuture: Fail # Issue 26429
async_return_types_test/wrongTypeParameter: Fail # Issue 26429
regress_26133_test: RuntimeError # Issue 26429
regress_29405_test: Fail # Issue 29422
type_variable_bounds_test/02: Fail # Issue 12702
@ -182,6 +202,9 @@ positional_parameters_type_test/01: MissingRuntimeError, OK
positional_parameters_type_test/02: MissingRuntimeError, OK
issue13474_test: RuntimeError, OK
[ $compiler == dart2js && ! $checked && ! $enable_asserts && ! $dart2js_with_kernel ]
assertion_test: RuntimeError # Issue 12748
[ $compiler == dart2js && ! $checked && $enable_asserts && ! $dart2js_with_kernel ]
bool_check_test: RuntimeError # Issue 29647
@ -291,7 +314,25 @@ switch_case_warn_test: SKIP # Analyzer only, see language_analyzer2.status
[ $compiler == dart2js && $dart2js_with_kernel_in_ssa ]
constants_test/01: Crash
abstract_beats_arguments_test: RuntimeError # Issue 27394
abstract_runtime_error_test/01: RuntimeError # Issue 27394
abstract_runtime_error_test/02: RuntimeError # Issue 27394
arithmetic_canonicalization_test: RuntimeError # Issue 27394
assertion_initializer_const_error_test/01: Crash
assertion_initializer_const_function_test/01: Crash
assign_top_method_test/01: Crash # Issue 27394
async_await_syntax_test/a04b: Crash # Issue 27394
async_await_syntax_test/a06a: RuntimeError # Issue 27394
async_await_syntax_test/a07b: Crash # Issue 27394
async_await_syntax_test/a08b: Crash # Issue 27394
async_await_syntax_test/b06a: RuntimeError # Issue 27394
async_await_syntax_test/c06a: RuntimeError # Issue 27394
async_await_syntax_test/d06a: RuntimeError # Issue 27394
async_await_test: RuntimeError # Issue 27394
async_star_pause_test: RuntimeError # Issue 27394
async_star_regression_fisk_test: RuntimeError # Issue 27394
async_star_stream_take_test: RuntimeError # Issue 27394
async_star_take_reyield_test: RuntimeError # Issue 27394
async_star_test: RuntimeError # Issue 27394
await_for_test: RuntimeError # Issue 27394
await_for_use_local_test: RuntimeError # Issue 27394
@ -513,6 +554,9 @@ function_type/function_type99_test: Crash # Issue 27394
generic_function_typedef_test: Crash # Issue 27394
getter_setter_in_lib_test: Crash # Issue 27394
[ $compiler == dart2js && $runtime == d8 && $checked && $dart2js_with_kernel_in_ssa && ! $dart2js_with_kernel ]
assertion_initializer_const_function_test/none: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel_in_ssa && $host_checked && ! $dart2js_with_kernel ]
conditional_method_invocation_test/02: Crash # Issue 27394
conditional_method_invocation_test/04: Crash # Issue 27394
@ -538,7 +582,112 @@ named_parameters_test/07: Crash # Issue 27394
named_parameters_test/09: Crash # Issue 27394
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel ]
abstract_method_test: Crash
abstract_object_method_test: Crash
abstract_runtime_error_test/01: Crash
abstract_runtime_error_test/02: Crash
arg_param_trailing_comma_test/none: Crash
arithmetic2_test: Crash
arithmetic_test: Crash
assert_message_test: Crash
assert_trailing_comma_test/none: CompileTimeError
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_test: CompileTimeError
assertion_test: Crash
assign_to_type_test/01: Crash
assign_to_type_test/02: Crash
assign_to_type_test/03: Crash
assign_to_type_test/04: Crash
assign_top_method_test/01: Crash
async_and_or_test: Crash
async_await_catch_regression_test: Crash
async_await_syntax_test/a01a: Crash
async_await_syntax_test/a02a: Crash
async_await_syntax_test/a03a: Crash
async_await_syntax_test/a03b: Crash
async_await_syntax_test/a04a: RuntimeError
async_await_syntax_test/a04c: RuntimeError
async_await_syntax_test/a05a: Crash
async_await_syntax_test/a05b: Crash
async_await_syntax_test/a05c: Crash
async_await_syntax_test/a05e: Crash
async_await_syntax_test/a06a: Crash
async_await_syntax_test/a07a: RuntimeError
async_await_syntax_test/a08a: RuntimeError
async_await_syntax_test/a09a: Crash
async_await_syntax_test/a10a: Crash
async_await_syntax_test/a11b: RuntimeError
async_await_syntax_test/a11c: Crash
async_await_syntax_test/a11d: Crash
async_await_syntax_test/a12g: Crash
async_await_syntax_test/b01a: Crash
async_await_syntax_test/b02a: Crash
async_await_syntax_test/b03a: Crash
async_await_syntax_test/b04a: RuntimeError
async_await_syntax_test/b05a: Crash
async_await_syntax_test/b06a: Crash
async_await_syntax_test/b07a: RuntimeError
async_await_syntax_test/b08a: RuntimeError
async_await_syntax_test/b09a: Crash
async_await_syntax_test/b10a: Crash
async_await_syntax_test/b11b: RuntimeError
async_await_syntax_test/b11c: Crash
async_await_syntax_test/b11d: Crash
async_await_syntax_test/b12g: Crash
async_await_syntax_test/c01a: Crash
async_await_syntax_test/c02a: Crash
async_await_syntax_test/c03a: Crash
async_await_syntax_test/c04a: Crash
async_await_syntax_test/c05a: Crash
async_await_syntax_test/c06a: Crash
async_await_syntax_test/c07a: Crash
async_await_syntax_test/c08a: Crash
async_await_syntax_test/c09a: Crash
async_await_syntax_test/c10a: Crash
async_await_syntax_test/d01a: Crash
async_await_syntax_test/d02a: Crash
async_await_syntax_test/d03a: Crash
async_await_syntax_test/d04a: RuntimeError
async_await_syntax_test/d05a: Crash
async_await_syntax_test/d06a: Crash
async_await_syntax_test/d07a: RuntimeError
async_await_syntax_test/d08a: RuntimeError
async_await_syntax_test/d08b: RuntimeError
async_await_syntax_test/d08c: RuntimeError
async_await_syntax_test/d09a: Crash
async_await_syntax_test/d10a: Crash
async_await_test: Crash
async_break_in_finally_test: Crash
async_continue_label_test/await_in_body: Crash
async_continue_label_test/await_in_condition: Crash
async_continue_label_test/await_in_init: Crash
async_continue_label_test/await_in_update: Crash
async_continue_label_test/none: Crash
async_control_structures_test: Crash
async_finally_rethrow_test: Crash
async_or_generator_return_type_stacktrace_test/01: Crash
async_or_generator_return_type_stacktrace_test/02: Crash
async_or_generator_return_type_stacktrace_test/03: Crash
async_or_generator_return_type_stacktrace_test/none: Crash
async_regression_23058_test: Crash
async_rethrow_test: Crash
async_return_types_test/nestedFuture: Crash
async_return_types_test/none: Crash
async_return_types_test/tooManyTypeParameters: Crash
async_return_types_test/wrongReturnType: Crash
async_return_types_test/wrongTypeParameter: Crash
async_star_cancel_and_throw_in_finally_test: Crash
async_star_cancel_while_paused_test: Crash
async_star_no_cancel2_test: Crash
async_star_no_cancel_test: Crash
async_star_pause_test: Crash
async_star_regression_2238_test: Crash
async_star_regression_23116_test: Crash
async_star_regression_fisk_test: Crash
async_star_stream_take_test: Crash
async_star_take_reyield_test: Crash
async_star_test: Crash
async_switch_test/none: Crash
async_switch_test/withDefault: Crash
@ -2046,6 +2195,13 @@ void_type_test: Crash
yieldstar_pause_test: Crash
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel && $host_checked ]
assertion_initializer_const_function_test/01: Crash
assign_instance_method_negative_test: Crash
async_await_syntax_test/d04a: Crash
async_await_syntax_test/d07a: Crash
async_await_syntax_test/d08a: Crash
async_await_syntax_test/d08b: Crash
async_await_syntax_test/d08c: Crash
bad_override_test/04: Crash
bailout3_test: Crash
bailout5_test: Crash
@ -2341,6 +2497,35 @@ wrong_number_type_arguments_test/00: Crash
wrong_number_type_arguments_test/02: Crash
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel && $minified ]
assert_assignable_type_test: Crash
assert_with_type_test_or_cast_test: Crash
assertion_initializer_const_error_test/none: Crash
assertion_initializer_const_function_error_test/none: Crash
assertion_initializer_const_function_test/01: Crash
assertion_initializer_const_function_test/none: Crash
assign_instance_method_negative_test: Crash
assign_op_test: Crash
assign_static_type_test/03: Crash
assign_static_type_test/04: Crash
assignable_expression_test/none: Crash
async_await_syntax_test/a04a: Crash
async_await_syntax_test/a04c: Crash
async_await_syntax_test/a07a: Crash
async_await_syntax_test/a08a: Crash
async_await_syntax_test/a11b: Crash
async_await_syntax_test/b04a: Crash
async_await_syntax_test/b07a: Crash
async_await_syntax_test/b08a: Crash
async_await_syntax_test/b11b: Crash
async_await_syntax_test/b13a: Crash
async_await_syntax_test/b13c: Crash
async_await_syntax_test/b14a: Crash
async_await_syntax_test/b14c: Crash
async_await_syntax_test/d04a: Crash
async_await_syntax_test/d07a: Crash
async_await_syntax_test/d08a: Crash
async_await_syntax_test/d08b: Crash
async_await_syntax_test/d08c: Crash
bad_constructor_test/05: Crash
bad_constructor_test/none: Crash
bad_override_test/01: Crash

View file

@ -2,6 +2,34 @@
# 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.
[$compiler == dartk && $runtime == vm]
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
[$compiler == dartk && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
[$compiler == dartk && $runtime == vm && $checked]
assertion_initializer_const_function_test/01: RuntimeError
[$compiler == dartkp && $runtime == dart_precompiled]
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == dartkp && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
[$compiler == dartkp && $runtime == dart_precompiled && $checked]
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error_test/none: Crash
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_const_function_error_test/none: Crash
assertion_initializer_const_function_test/01: Crash
assertion_initializer_const_function_test/none: Crash
assertion_initializer_test: CompileTimeError
[ !$checked && ($compiler == dartk || $compiler == dartkp) ]
deferred_constraints_type_annotation_test/type_annotation1: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
@ -9,6 +37,7 @@ deferred_constraints_type_annotation_test/type_annotation_generic1: CompileTimeE
deferred_constraints_type_annotation_test/type_annotation_generic4: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
[ $compiler == dartk || $compiler == dartkp ]
assert_trailing_comma_test/none: CompileTimeError # Issue 29959
method_override_test: RuntimeError # Not triaged.
cha_deopt1_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
@ -228,7 +257,27 @@ regress_23498_test: Crash
# dartk: checked mode failures
[ $checked && ($compiler == dartk || $compiler == dartkp) ]
assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/32: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/33: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/34: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/35: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/36: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/37: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/38: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/41: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/42: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/43: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/44: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/45: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/46: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/47: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/48: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
assign_static_type_test/02: MissingCompileTimeError
async_await_test: RuntimeError
async_return_types_test/nestedFuture: Fail
async_return_types_test/wrongTypeParameter: Fail
compile_time_constant_checked_test/02: MissingCompileTimeError
const_constructor2_test/20: MissingCompileTimeError
const_constructor2_test/22: MissingCompileTimeError

View file

@ -1,25 +0,0 @@
// Copyright (c) 2012, 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.
// This test insures that statically initialized variables, fields, and parameters
// report compile-time errors.
int a = "String"; //# 01: compile-time error
class A {
static const int c = "String"; //# 02: compile-time error
final int d = "String"; //# 03: compile-time error
int e = "String"; //# 04: compile-time error
A() {
int f = "String"; //# 05: compile-time error
}
method(
[
int //# 06: compile-time error
g = "String"]) {
return g;
}
}
main() {}

View file

@ -1,25 +0,0 @@
// Copyright (c) 2015, 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.
// Verify that an attempt to assign to a class, enum, typedef, or type
// parameter produces a compile error.
class C<T> {
f() {
T = null; //# 01: compile-time error
}
}
class D {}
enum E { e0 }
typedef void F();
main() {
new C<D>().f();
D = null; //# 02: compile-time error
E = null; //# 03: compile-time error
F = null; //# 04: compile-time error
}

View file

@ -1,44 +0,0 @@
// Copyright (c) 2013, 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.
// Test to detect syntactically illegal left-hand-side (assignable)
// expressions.
class C {
static dynamic field = 0;
}
dynamic variable = 0;
main() {
variable = 0;
(variable) = 0; // //# 01: compile-time error
(variable)++; // //# 02: compile-time error
++(variable); // //# 03: compile-time error
C.field = 0;
(C.field) = 0; // //# 11: compile-time error
(C.field)++; // //# 12: compile-time error
++(C.field); // //# 13: compile-time error
variable = [1, 2, 3];
variable[0] = 0;
(variable)[0] = 0;
(variable[0]) = 0; // //# 21: compile-time error
(variable[0])++; // //# 22: compile-time error
++(variable[0]); // //# 23: compile-time error
C.field = [1, 2, 3];
(C.field[0]) = 0; // //# 31: compile-time error
(C.field[0])++; // //# 32: compile-time error
++(C.field[0]); // //# 33: compile-time error
var a = 0;
(a) = 0; // //# 41: compile-time error
(a)++; // //# 42: compile-time error
++(a); // //# 43: compile-time error
// Neat palindrome expression. x is assignable, ((x)) is not.
var funcnuf = (x) => ((x))=((x)) <= (x); // //# 50: compile-time error
}

View file

@ -1,11 +0,0 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
void badReturnTypeAsync() async {} // //# 01: compile-time error
void badReturnTypeAsyncStar() async* {} // //# 02: compile-time error
void badReturnTypeSyncStar() sync* {} // //# 03: compile-time error
void main() {}

View file

@ -4,84 +4,16 @@
# The VM and dart2js do not implement the Dart 2.0 static type errors yet.
# Analyzer does, but only when "--strong" is used.
[ $runtime == vm || $compiler == dart2js || $runtime == dart_precompiled || ($compiler == dart2analyzer && ! $strong && ! $checked) ]
[ $runtime == vm || $compiler == dart2js || $runtime == dart_precompiled || ($compiler == dart2analyzer && ! $strong) ]
abstract_beats_arguments_test: MissingCompileTimeError
abstract_exact_selector_test/01: MissingCompileTimeError
abstract_factory_constructor_test/00: MissingCompileTimeError
abstract_getter_test/01: MissingCompileTimeError
abstract_syntax_test/00: MissingCompileTimeError
assign_top_method_test: MissingCompileTimeError
assign_static_type_test/01: MissingCompileTimeError
assign_static_type_test/02: MissingCompileTimeError
assign_static_type_test/03: MissingCompileTimeError
assign_static_type_test/04: MissingCompileTimeError
assign_static_type_test/05: MissingCompileTimeError
assign_static_type_test/06: MissingCompileTimeError
assign_to_type_test/01: MissingCompileTimeError
assign_to_type_test/02: MissingCompileTimeError
assign_to_type_test/03: MissingCompileTimeError
assign_to_type_test/04: MissingCompileTimeError
async_await_syntax_test/a10a: MissingCompileTimeError
async_await_syntax_test/b10a: MissingCompileTimeError
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/wrongTypeParameter: MissingCompileTimeError
async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
[ $compiler == dart2analyzer && ! $strong && $checked ]
abstract_beats_arguments_test: MissingCompileTimeError
abstract_exact_selector_test/01: MissingCompileTimeError
abstract_factory_constructor_test/00: MissingCompileTimeError
abstract_getter_test/01: MissingCompileTimeError
abstract_syntax_test/00: MissingCompileTimeError
assign_top_method_test: MissingCompileTimeError
assign_static_type_test/01: MissingCompileTimeError
assign_static_type_test/03: MissingCompileTimeError
assign_static_type_test/04: MissingCompileTimeError
assign_static_type_test/05: MissingCompileTimeError
assign_static_type_test/06: MissingCompileTimeError
assign_to_type_test/01: MissingCompileTimeError
assign_to_type_test/02: MissingCompileTimeError
assign_to_type_test/03: MissingCompileTimeError
assign_to_type_test/04: MissingCompileTimeError
async_await_syntax_test/a10a: MissingCompileTimeError
async_await_syntax_test/b10a: MissingCompileTimeError
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/wrongTypeParameter: MissingCompileTimeError
async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
[ $compiler == dartdevc || $compiler == dart2analyzer ]
async_return_types_test/nestedFuture: MissingCompileTimeError
[ $compiler == dart2js && ! $dart2js_with_kernel ]
accessor_conflict_export2_test: Crash # Issue 25626
accessor_conflict_export_test: Crash # Issue 25626
assertion_initializer_const_error2_test/cc01: Crash
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error2_test/cc03: Crash
assertion_initializer_const_error2_test/cc04: Crash
assertion_initializer_const_error2_test/cc05: Crash
assertion_initializer_const_error2_test/cc06: Crash
assertion_initializer_const_error2_test/cc07: Crash
assertion_initializer_const_error2_test/cc08: Crash
assertion_initializer_const_error2_test/cc09: Crash
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_const_function_test/01: CompileTimeError
assertion_initializer_test: Crash
assert_trailing_comma_test/none: CompileTimeError # Issue 29959
[ $compiler == dart2js && $runtime != none && ! $dart2js_with_kernel ]
accessor_conflict_import2_test: RuntimeError # Issue 25626
@ -148,374 +80,5 @@ and_operation_on_non_integer_operand_test: Crash
arithmetic_canonicalization_test: Crash
arithmetic_smi_overflow_test: Crash
[ $compiler == dartdevc && $runtime != none ]
async_star_cancel_while_paused_test: RuntimeError # Issue 29920
async_star_pause_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $use_sdk ]
*: Skip # Issue 29626
[ $compiler == dart2js && ! $checked && ! $enable_asserts && ! $dart2js_with_kernel && $runtime != none ]
assertion_test: RuntimeError # Issue 12748
[ $compiler == dart2js && $dart2js_with_kernel_in_ssa ]
abstract_beats_arguments_test: RuntimeError # Issue 27394
abstract_runtime_error_test/01: RuntimeError # Issue 27394
abstract_runtime_error_test/02: RuntimeError # Issue 27394
arithmetic_canonicalization_test: RuntimeError # Issue 27394
assertion_initializer_const_error_test/01: Crash
assertion_initializer_const_function_test/01: Crash
assign_top_method_test/01: Crash # Issue 27394
async_await_syntax_test/a04b: Crash # Issue 27394
async_await_syntax_test/a06a: RuntimeError # Issue 27394
async_await_syntax_test/a07b: Crash # Issue 27394
async_await_syntax_test/a08b: Crash # Issue 27394
async_await_syntax_test/b06a: RuntimeError # Issue 27394
async_await_syntax_test/c06a: RuntimeError # Issue 27394
async_await_syntax_test/d06a: RuntimeError # Issue 27394
[ $compiler == dart2js && $runtime == d8 && $checked && $dart2js_with_kernel_in_ssa && ! $dart2js_with_kernel ]
assertion_initializer_const_function_test/none: RuntimeError
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel && $host_checked ]
assertion_initializer_const_function_test/01: Crash
assign_instance_method_negative_test: Crash
async_await_syntax_test/d04a: Crash
async_await_syntax_test/d07a: Crash
async_await_syntax_test/d08a: Crash
async_await_syntax_test/d08b: Crash
async_await_syntax_test/d08c: Crash
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel && $minified ]
assert_assignable_type_test: Crash
assert_with_type_test_or_cast_test: Crash
assertion_initializer_const_error_test/none: Crash
assertion_initializer_const_function_error_test/none: Crash
assertion_initializer_const_function_test/01: Crash
assertion_initializer_const_function_test/none: Crash
assign_instance_method_negative_test: Crash
assign_op_test: Crash
assign_static_type_test/03: Crash
assign_static_type_test/04: Crash
assignable_expression_test/none: Crash
async_await_syntax_test/a04a: Crash
async_await_syntax_test/a04c: Crash
async_await_syntax_test/a07a: Crash
async_await_syntax_test/a08a: Crash
async_await_syntax_test/a11b: Crash
async_await_syntax_test/b04a: Crash
async_await_syntax_test/b07a: Crash
async_await_syntax_test/b08a: Crash
async_await_syntax_test/b11b: Crash
async_await_syntax_test/b13a: Crash
async_await_syntax_test/b13c: Crash
async_await_syntax_test/b14a: Crash
async_await_syntax_test/b14c: Crash
async_await_syntax_test/d04a: Crash
async_await_syntax_test/d07a: Crash
async_await_syntax_test/d08a: Crash
async_await_syntax_test/d08b: Crash
async_await_syntax_test/d08c: Crash
[ ($runtime != vm && $compiler != dartk && $compiler != dartkp ) || ($compiler != none && $compiler != dartk && $compiler != dartkp )]
assert_initializer_test/*: Skip # Not implemented yet, experiment is VM only.
[ $compiler == dart2analyzer && $runtime == none ]
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_test/01: CompileTimeError
assertion_initializer_test: CompileTimeError
# dartdevc doesn't support assertions in initializers.
[ $compiler == dartdevc ]
assertion_initializer_test: CompileTimeError
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_test/01: CompileTimeError
[ $compiler == dartdevc && $runtime != none ]
assert_message_test: RuntimeError # Looks like bug in dartdevc codegen.
[ $compiler == dartk && $runtime == vm ]
arithmetic2_test: RuntimeError # Throws CastError instead of TypeError
assertion_test: RuntimeError
[ $mode == product ]
assertion_test: SkipByDesign # Requires checked mode.
[$compiler == precompiler && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error2_test/cc01: Pass, OK
assertion_initializer_const_error2_test/cc02: CompileTimeError
assertion_initializer_const_error2_test/cc03: Pass, OK
assertion_initializer_const_error2_test/cc04: Pass, OK
assertion_initializer_const_error2_test/cc05: Pass, OK
assertion_initializer_const_error2_test/cc06: Pass, OK
assertion_initializer_const_error2_test/cc07: Pass, OK
assertion_initializer_const_error2_test/cc08: Pass, OK
assertion_initializer_const_error2_test/cc09: Pass, OK
assertion_initializer_const_error2_test/cc10: Pass, OK
assertion_initializer_const_error2_test/cc11: Pass, OK
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == precompiler && $runtime == dart_precompiled && $checked]
assertion_initializer_const_error2_test/cc01: Pass
assertion_initializer_const_error2_test/cc03: Pass
assertion_initializer_const_error2_test/cc04: Pass
assertion_initializer_const_error2_test/cc05: Pass
assertion_initializer_const_error2_test/cc06: Pass
assertion_initializer_const_error2_test/cc07: Pass
assertion_initializer_const_error2_test/cc08: Pass
assertion_initializer_const_error2_test/cc09: Pass
assertion_initializer_const_error2_test/cc10: Pass
assertion_initializer_const_error2_test/cc11: Pass
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == none && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[$compiler == none && $runtime == drt && !$checked]
assertion_initializer_const_error2_test/cc02: Fail
assertion_initializer_const_error_test/01: Fail
assertion_initializer_const_function_error_test/01: Fail
[$compiler == app_jit && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[ $compiler == precompiler && $runtime == dart_precompiled ]
assertion_initializer_const_error2_test/cc01: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc02: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc03: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc04: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc05: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc06: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc07: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc08: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc09: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc10: Crash, MissingCompileTimeError
assertion_initializer_const_error2_test/cc11: Crash, MissingCompileTimeError
[ $compiler == precompiler && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
[$compiler == dartk && $runtime == vm]
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
[$compiler == dartk && $runtime == vm && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
[$compiler == dartk && $runtime == vm && $checked]
assertion_initializer_const_function_test/01: RuntimeError
[$compiler == dartkp && $runtime == dart_precompiled]
assertion_initializer_const_error2_test/none: CompileTimeError
[$compiler == dartkp && $runtime == dart_precompiled && !$checked]
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
[$compiler == dartkp && $runtime == dart_precompiled && $checked]
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error_test/none: Crash
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_const_function_error_test/none: Crash
assertion_initializer_const_function_test/01: Crash
assertion_initializer_const_function_test/none: Crash
assertion_initializer_test: CompileTimeError
[ $compiler == dartk || $compiler == dartkp ]
assert_trailing_comma_test/none: CompileTimeError # Issue 29959
# dartk: checked mode failures
[ $checked && ($compiler == dartk || $compiler == dartkp) ]
assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/32: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/33: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/34: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/35: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/36: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/37: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/38: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/41: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/42: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/43: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/44: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/45: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/46: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/47: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/48: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
assign_static_type_test/02: MissingCompileTimeError
[($runtime == vm || $runtime == flutter) && $compiler == none && $checked]
# The VM doesn't enforce that potentially const expressions are actually
# const expressions when the constructor is called with `const`.
assert_initializer_test/4*: MissingCompileTimeError # Issue 392.
[ $compiler == dart2js && ! $dart2js_with_kernel && $runtime != none ]
async_star_cancel_while_paused_test: RuntimeError # Issue 22853
[ $compiler == dart2js && $runtime == jsshell && ! $dart2js_with_kernel ]
async_star_no_cancel_test: RuntimeError # Need triage
async_star_no_cancel2_test: RuntimeError # Need triage
[ $compiler == dart2js && $checked && ! $dart2js_with_kernel ]
async_return_types_test/nestedFuture: Fail # Issue 26429
async_return_types_test/wrongTypeParameter: Fail # Issue 26429
[ $compiler == dart2js && $dart2js_with_kernel_in_ssa ]
async_star_pause_test: RuntimeError # Issue 27394
async_star_regression_fisk_test: RuntimeError # Issue 27394
async_star_stream_take_test: RuntimeError # Issue 27394
async_star_take_reyield_test: RuntimeError # Issue 27394
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel ]
async_break_in_finally_test: Crash
async_continue_label_test/await_in_body: Crash
async_continue_label_test/await_in_condition: Crash
async_continue_label_test/await_in_init: Crash
async_continue_label_test/await_in_update: Crash
async_continue_label_test/none: Crash
async_control_structures_test: Crash
async_finally_rethrow_test: Crash
async_or_generator_return_type_stacktrace_test/01: Crash
async_or_generator_return_type_stacktrace_test/02: Crash
async_or_generator_return_type_stacktrace_test/03: Crash
async_or_generator_return_type_stacktrace_test/none: Crash
async_regression_23058_test: Crash
async_rethrow_test: Crash
async_return_types_test/nestedFuture: Crash
async_return_types_test/none: Crash
async_return_types_test/tooManyTypeParameters: Crash
async_return_types_test/wrongReturnType: Crash
async_return_types_test/wrongTypeParameter: Crash
async_star_cancel_and_throw_in_finally_test: Crash
async_star_cancel_while_paused_test: Crash
async_star_no_cancel2_test: Crash
async_star_no_cancel_test: Crash
async_star_pause_test: Crash
async_star_regression_2238_test: Crash
async_star_regression_23116_test: Crash
async_star_regression_fisk_test: Crash
async_star_stream_take_test: Crash
async_star_take_reyield_test: Crash
[ $checked && ($compiler == dartk || $compiler == dartkp) ]
async_return_types_test/nestedFuture: Fail
async_return_types_test/wrongTypeParameter: Fail
# These test entries will be valid for vm (with and without kernel).
[ $compiler == none || $compiler == app_jit || $compiler == dartk || $runtime == dart_precompiled ]
async_star_cancel_while_paused_test: RuntimeError
# This is OK for now, but we may want to change the semantics to match the test.
async_star_pause_test: Fail, OK
[ $compiler == dartk && $runtime == vm ]
async_star_cancel_and_throw_in_finally_test: RuntimeError
async_star_cancel_while_paused_test: RuntimeError
async_star_regression_fisk_test: Timeout
async_star_stream_take_test: Timeout
async_star_take_reyield_test: Timeout
[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
async_star_regression_2238_test: CompileTimeError, RuntimeError
# flutter uses --error_on_bad_type, --error_on_bad_override
# and --await_is_keyword so # the following tests fail with
# a Compilation Error
[ $runtime == flutter ]
async_await_test: CompileTimeError
async_await_syntax_test/a05c: CompileTimeError
async_await_syntax_test/a05e: CompileTimeError
async_await_syntax_test/d08c: CompileTimeError
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel ]
abstract_method_test: Crash
abstract_object_method_test: Crash
abstract_runtime_error_test/01: Crash
abstract_runtime_error_test/02: Crash
arg_param_trailing_comma_test/none: Crash
arithmetic_test: Crash
assert_message_test: Crash
assert_trailing_comma_test/none: CompileTimeError
assertion_initializer_const_error2_test/cc02: Crash
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_const_function_error_test/01: Crash
assertion_initializer_test: CompileTimeError
assertion_test: Crash
assign_to_type_test/01: Crash
assign_to_type_test/02: Crash
assign_to_type_test/03: Crash
assign_to_type_test/04: Crash
assign_top_method_test/01: Crash
async_and_or_test: Crash
async_await_catch_regression_test: Crash
async_await_syntax_test/a01a: Crash
async_await_syntax_test/a02a: Crash
async_await_syntax_test/a03a: Crash
async_await_syntax_test/a03b: Crash
async_await_syntax_test/a04a: RuntimeError
async_await_syntax_test/a04c: RuntimeError
async_await_syntax_test/a05a: Crash
async_await_syntax_test/a05b: Crash
async_await_syntax_test/a05c: Crash
async_await_syntax_test/a05e: Crash
async_await_syntax_test/a06a: Crash
async_await_syntax_test/a07a: RuntimeError
async_await_syntax_test/a08a: RuntimeError
async_await_syntax_test/a09a: Crash
async_await_syntax_test/a10a: Crash
async_await_syntax_test/a11b: RuntimeError
async_await_syntax_test/a11c: Crash
async_await_syntax_test/a11d: Crash
async_await_syntax_test/a12g: Crash
async_await_syntax_test/b01a: Crash
async_await_syntax_test/b02a: Crash
async_await_syntax_test/b03a: Crash
async_await_syntax_test/b04a: RuntimeError
async_await_syntax_test/b05a: Crash
async_await_syntax_test/b06a: Crash
async_await_syntax_test/b07a: RuntimeError
async_await_syntax_test/b08a: RuntimeError
async_await_syntax_test/b09a: Crash
async_await_syntax_test/b10a: Crash
async_await_syntax_test/b11b: RuntimeError
async_await_syntax_test/b11c: Crash
async_await_syntax_test/b11d: Crash
async_await_syntax_test/b12g: Crash
async_await_syntax_test/c01a: Crash
async_await_syntax_test/c02a: Crash
async_await_syntax_test/c03a: Crash
async_await_syntax_test/c04a: Crash
async_await_syntax_test/c05a: Crash
async_await_syntax_test/c06a: Crash
async_await_syntax_test/c07a: Crash
async_await_syntax_test/c08a: Crash
async_await_syntax_test/c09a: Crash
async_await_syntax_test/c10a: Crash
async_await_syntax_test/d01a: Crash
async_await_syntax_test/d02a: Crash
async_await_syntax_test/d03a: Crash
async_await_syntax_test/d04a: RuntimeError
async_await_syntax_test/d05a: Crash
async_await_syntax_test/d06a: Crash
async_await_syntax_test/d07a: RuntimeError
async_await_syntax_test/d08a: RuntimeError
async_await_syntax_test/d08b: RuntimeError
async_await_syntax_test/d08c: RuntimeError
async_await_syntax_test/d09a: Crash
async_await_syntax_test/d10a: Crash
async_return_types_test/tooManyTypeParameters: CompileTimeError
# Look like bugs.
async_return_types_test/nestedFuture: Skip # Flutter Issue 9110
async_return_types_test/return_value_sync_star: Skip # Flutter Issue 9110
async_return_types_test/wrongReturnType: Skip # Flutter Issue 9110
async_return_types_test/wrongTypeParameter: Skip # Flutter Issue 9110
async_star_cancel_while_paused_test: Skip # Flutter Issue 9110
async_star_no_cancel_test: Skip # Flutter Issue 9110

View file

@ -0,0 +1,73 @@
// Copyright (c) 2012, 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.
// Dart test program to test arithmetic operations.
import "package:expect/expect.dart";
class A {
static foo() => 499;
}
bool throwsNoSuchMethod(f) {
try {
f();
return false;
} on NoSuchMethodError catch (e) {
return true;
}
return false;
}
bool throwsBecauseOfBadArgument(f) {
try {
f();
return false;
} on NoSuchMethodError catch (e) {
return true;
} on ArgumentError catch (e) {
return true;
} on TypeError catch (e) {
// In type checked mode.
return true;
}
return false;
}
numberOpBadSecondArgument(f) {
Expect.isTrue(throwsBecauseOfBadArgument(() => f(true)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(new A())));
Expect.isTrue(throwsBecauseOfBadArgument(() => f("foo")));
Expect.isTrue(throwsBecauseOfBadArgument(() => f("5")));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(() => 499)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(null)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(false)));
Expect.isTrue(throwsBecauseOfBadArgument(() => f([])));
Expect.isTrue(throwsBecauseOfBadArgument(() => f({})));
Expect.isTrue(throwsBecauseOfBadArgument(() => f(A.foo)));
}
badOperations(b) {
Expect.isTrue(throwsNoSuchMethod(() => b - 3));
Expect.isTrue(throwsNoSuchMethod(() => b * 3));
Expect.isTrue(throwsNoSuchMethod(() => b ~/ 3));
Expect.isTrue(throwsNoSuchMethod(() => b / 3));
Expect.isTrue(throwsNoSuchMethod(() => b % 3));
Expect.isTrue(throwsNoSuchMethod(() => b + 3));
Expect.isTrue(throwsNoSuchMethod(() => b[3]));
Expect.isTrue(throwsNoSuchMethod(() => ~b));
Expect.isTrue(throwsNoSuchMethod(() => -b));
}
main() {
numberOpBadSecondArgument((x) => 3 + x);
numberOpBadSecondArgument((x) => 3 - x);
numberOpBadSecondArgument((x) => 3 * x);
numberOpBadSecondArgument((x) => 3 / x);
numberOpBadSecondArgument((x) => 3 ~/ x);
numberOpBadSecondArgument((x) => 3 % x);
badOperations(true);
badOperations(false);
badOperations(() => 499);
badOperations(A.foo);
}

View file

@ -0,0 +1,28 @@
// Copyright (c) 2013, 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.
// Dart test program to test arithmetic operations.
// VMOptions=--optimization-counter-threshold=10 --checked
// This test crashes if we recompute type of AssertAssignableInstr based on its
// output types. By doing that we would eliminate not only the unnecessary
// AssertAssignableInstr but also the trailing class check.
main() {
// Foul up IC data in integer's unary minus.
var y = -0x80000000;
testInt64List();
}
testInt64List() {
var array = new List(10);
testInt64ListImpl(array);
}
testInt64ListImpl(array) {
for (int i = 0; i < 10; ++i) {}
int sum = 0;
for (int i = 0; i < 10; ++i) {
array[i] = -0x80000000000000 + i;
}
}

View file

@ -0,0 +1,28 @@
// Copyright (c) 2012, 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.
// Issue 3741: generic type tests and casts fail in assertion statements
// when run in production mode.
//
// The cause was incomplete generic type skipping, so each of the assert
// statements below would fail.
//
// VMOptions=
// VMOptions=--enable_asserts
main() {
var names = new List<int>();
// Generic type test.
assert(names is List<int>);
// Negated generic type test.
assert(names is! List<String>);
// Generic type cast.
assert((names as List<num>).length == 0);
// Generic type test inside expression.
assert((names is List<int>));
}

View file

@ -1,8 +1,8 @@
// Copyright (c) 2011, 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.
// VMOptions=--enable_type_checks --enable_asserts
// VMOptions=--enable_type_checks
//
// Dart test program testing assert statements.
import "package:expect/expect.dart";

View file

@ -0,0 +1,18 @@
// Copyright (c) 2011, 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.
class A {
A() {}
imethod() {
return 0;
}
}
main() {
var a = new A();
// Illegal, can't change a member method
a.imethod = () {
return 1;
};
}

View file

@ -0,0 +1,96 @@
// Copyright (c) 2011, 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.
// Dart test program for testing assign operators.
// VMOptions=--optimization-counter-threshold=10
import "package:expect/expect.dart";
class AssignOpTest {
AssignOpTest() {}
static testMain() {
var b = 0;
b += 1;
Expect.equals(1, b);
b *= 5;
Expect.equals(5, b);
b -= 1;
Expect.equals(4, b);
b ~/= 2;
Expect.equals(2, b);
f = 0;
f += 1;
Expect.equals(1, f);
f *= 5;
Expect.equals(5, f);
f -= 1;
Expect.equals(4, f);
f ~/= 2;
Expect.equals(2, f);
f /= 4;
Expect.equals(.5, f);
AssignOpTest.f = 0;
AssignOpTest.f += 1;
Expect.equals(1, AssignOpTest.f);
AssignOpTest.f *= 5;
Expect.equals(5, AssignOpTest.f);
AssignOpTest.f -= 1;
Expect.equals(4, AssignOpTest.f);
AssignOpTest.f ~/= 2;
Expect.equals(2, AssignOpTest.f);
AssignOpTest.f /= 4;
Expect.equals(.5, f);
var o = new AssignOpTest();
o.instf = 0;
o.instf += 1;
Expect.equals(1, o.instf);
o.instf *= 5;
Expect.equals(5, o.instf);
o.instf -= 1;
Expect.equals(4, o.instf);
o.instf ~/= 2;
Expect.equals(2, o.instf);
o.instf /= 4;
Expect.equals(.5, o.instf);
var x = 0xFF;
x >>= 3;
Expect.equals(0x1F, x);
x <<= 3;
Expect.equals(0xF8, x);
x |= 0xF00;
Expect.equals(0xFF8, x);
x &= 0xF0;
Expect.equals(0xF0, x);
x ^= 0x11;
Expect.equals(0xE1, x);
var y = 100;
y += 1 << 3;
Expect.equals(108, y);
y *= 2 + 1;
Expect.equals(324, y);
y -= 3 - 2;
Expect.equals(323, y);
y += 3 * 4;
Expect.equals(335, y);
var a = [1, 2, 3];
var ix = 0;
a[ix] |= 12;
Expect.equals(13, a[ix]);
}
static var f;
var instf;
}
main() {
for (int i = 0; i < 20; i++) {
AssignOpTest.testMain();
}
}

View file

@ -0,0 +1,33 @@
// Copyright (c) 2012, 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.
// This test insures that statically initialized variables, fields, and parameters
// report static type warnings.
int a = "String"; // //# 01: static type warning, dynamic type error
class A {
static const int c = "String"; //# 02: static type warning, checked mode compile-time error
final int d = "String"; //# 03: static type warning, dynamic type error
int e = "String"; //# 04: static type warning, dynamic type error
A() {
int f = "String"; //# 05: static type warning, dynamic type error
}
method(
[
int // //# 06: static type warning
g = "String"]) {
return g;
}
}
int main() {
var w = a; //# 01: continued
var x;
x = A.c; // //# 02: continued
var v = new A();
x = v.d; // //# 03: continued
x = v.e; // //# 04: continued
x = v.method(1); //# 06: continued
}

View file

@ -0,0 +1,29 @@
// Copyright (c) 2015, 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.
// Verify that an attempt to assign to a class, enum, typedef, or type
// parameter produces a static warning and runtime error.
import "package:expect/expect.dart";
noMethod(e) => e is NoSuchMethodError;
class C<T> {
f() {
Expect.throws(() => T = null, noMethod); //# 01: static type warning
}
}
class D {}
enum E { e0 }
typedef void F();
main() {
new C<D>().f();
Expect.throws(() => D = null, noMethod); //# 02: static type warning
Expect.throws(() => E = null, noMethod); //# 03: static type warning
Expect.throws(() => F = null, noMethod); //# 04: static type warning
}

View file

@ -10,5 +10,6 @@ method() {
main() {
// Illegal, can't change a top level method
/*@compile-error=unspecified*/ method = () { return 1; };
Expect.throws(() { method = () { return 1; }; }, //# 01: static type warning
(e) => e is NoSuchMethodError); // //# 01: continued
}

View file

@ -0,0 +1,44 @@
// Copyright (c) 2013, 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.
// Test to detect syntactically illegal left-hand-side (assignable)
// expressions.
class C {
static var static_field = 0;
}
var tl_static_var = 0;
main() {
tl_static_var = 0;
(tl_static_var) = 0; // //# 01: compile-time error
(tl_static_var)++; // //# 02: compile-time error
++(tl_static_var); // //# 03: compile-time error
C.static_field = 0;
(C.static_field) = 0; // //# 11: compile-time error
(C.static_field)++; // //# 12: compile-time error
++(C.static_field); // //# 13: compile-time error
tl_static_var = [1, 2, 3];
tl_static_var[0] = 0;
(tl_static_var)[0] = 0;
(tl_static_var[0]) = 0; // //# 21: compile-time error
(tl_static_var[0])++; // //# 22: compile-time error
++(tl_static_var[0]); // //# 23: compile-time error
C.static_field = [1, 2, 3];
(C.static_field[0]) = 0; // //# 31: compile-time error
(C.static_field[0])++; // //# 32: compile-time error
++(C.static_field[0]); // //# 33: compile-time error
var a = 0;
(a) = 0; // //# 41: compile-time error
(a)++; // //# 42: compile-time error
++(a); // //# 43: compile-time error
// Neat palindrome expression. x is assignable, ((x)) is not.
var funcnuf = (x) => ((x))=((x)) <= (x); // //# 50: compile-time error
}

View file

@ -0,0 +1,88 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
@NoInline()
@AssumeDynamic()
confuse(x) {
return x;
}
test1() async {
Expect.isFalse(await confuse(false) && await confuse(false));
Expect.isFalse(await confuse(false) && await confuse(true));
Expect.isFalse(await confuse(true) && await confuse(false));
Expect.isTrue(await confuse(true) && await confuse(true));
Expect.isFalse(await confuse(false) || await confuse(false));
Expect.isTrue(await confuse(false) || await confuse(true));
Expect.isTrue(await confuse(true) || await confuse(false));
Expect.isTrue(await confuse(true) || await confuse(true));
}
String trace;
traceA(x) {
trace += "a";
return x;
}
traceB(x) {
trace += "b";
return x;
}
testEvaluation(void fn()) async {
trace = "";
await fn();
}
test2() async {
await testEvaluation(() async {
Expect
.isFalse(await confuse(traceA(false)) && await confuse(traceB(false)));
Expect.equals("a", trace);
});
await testEvaluation(() async {
Expect.isFalse(await confuse(traceA(false)) && await confuse(traceB(true)));
Expect.equals("a", trace);
});
await testEvaluation(() async {
Expect.isFalse(await confuse(traceA(true)) && await confuse(traceB(false)));
Expect.equals("ab", trace);
});
await testEvaluation(() async {
Expect.isTrue(await confuse(traceA(true)) && await confuse(traceB(true)));
Expect.equals("ab", trace);
});
await testEvaluation(() async {
Expect
.isFalse(await confuse(traceA(false)) || await confuse(traceB(false)));
Expect.equals("ab", trace);
});
await testEvaluation(() async {
Expect.isTrue(await confuse(traceA(false)) || await confuse(traceB(true)));
Expect.equals("ab", trace);
});
await testEvaluation(() async {
Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(false)));
Expect.equals("a", trace);
});
await testEvaluation(() async {
Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(true)));
Expect.equals("a", trace);
});
}
test() async {
await test1();
await test2();
}
main() {
asyncStart();
test().then((_) => asyncEnd());
}

View file

@ -0,0 +1,26 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
foo() async {
throw 42;
}
test() async {
var exception;
try {
await foo();
} catch (e) {
print(await (e));
await (exception = await e);
}
Expect.equals(42, exception);
}
main() {
asyncStart();
test().then((_) => asyncEnd());
}

View file

@ -0,0 +1,301 @@
// Copyright (c) 2015, 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.
// Test async/await syntax.
import 'dart:async' show Stream;
var yield = 0;
var await = 0;
get st => new Stream.fromIterable([]);
a01a() async => null; // //# a01a: ok
a01b() async* => null; // //# a01b: compile-time error
a01c() sync* => null; // //# a01c: compile-time error
a01d() async => yield 5; // //# a01d: compile-time error
a02a() async {} // //# a02a: ok
a03a() async* {} // //# a03a: ok
a03b() async * {} // //# a03b: ok
a04a() sync* {} // //# a04a: ok
a04b() sync {} // //# a04b: compile-time error
a04c() sync * {} // //# a04c: ok
a05a() async { await 0; } // //# a05a: ok
a05b() async { // //# a05b: ok
await(a) {}; // //# a05b: continued
await(0); // //# a05b: continued
} // //# a05b: continued
a05c() { // //# a05c: ok
await(a) {}; // //# a05c: continued
await(0); // //# a05c: continued
} // //# a05c: continued
a05d() async { // //# a05d: compile-time error
await(a) {} // //# a05d: continued
await(0); // //# a05d: continued
} // //# a05d: continued
a05e() { // //# a05e: ok
await(a) {} // //# a05e: continued
await(0); // //# a05e: continued
} // //# a05e: continued
a05f() async { // //# a05f: compile-time error
var await = (a) {}; // //# a05f: continued
await(0); // //# a05f: continued
} // //# a05f: continued
a05g() async { // //# a05g: continued
yield 5; // //# a05g: compile-time error
} // //# a05g: continued
a05h() async { // //# a05h: continued
yield* st; // //# a05h: compile-time error
} // //# a05h: continued
a06a() async { await for (var o in st) {} } // //# a06a: ok
a06b() sync* { await for (var o in st) {} } // //# a06b: compile-time error
a07a() sync* { yield 0; } // //# a07a: ok
a07b() sync { yield 0; } // //# a07b: compile-time error
a08a() sync* { yield* []; } // //# a08a: ok
a08b() sync { yield 0; } // //# a08b: compile-time error
a09a() async* { yield 0; } // //# a09a: ok
a10a() async* { yield* []; } // //# a10a: static type warning
get sync sync {} // //# a11a: compile-time error
get sync sync* {} // //# a11b: ok
get async async {} // //# a11c: ok
get async async* {} // //# a11d: ok
get sync {} // //# a12a: ok
get sync* {} // //# a12b: compile-time error
get async {} // //# a12c: ok
get async* {} // //# a12d: compile-time error
get a12e sync* => null; // //# a12e: compile-time error
get a12f async* => null; // //# a12f: compile-time error
get a12g async => null; // //# a12g: ok
int sync; // //# a13a: ok
int sync*; // //# a13b: compile-time error
int async; // //# a13c: ok
int async*; // //# a13d: compile-time error
var sync; // //# a14a: ok
var sync*; // //# a14b: compile-time error
var async; // //# a14c: ok
var async*; // //# a14d: compile-time error
sync() {} // //# a15a: ok
sync*() {} // //# a15b: compile-time error
async() {} // //# a15c: ok
async*() {} // //# a15d: compile-time error
abstract class B {
b00a() async; // //# b00a: compile-time error
b00b() async*; // //# b00b: compile-time error
b00c() sync*; // //# b00c: compile-time error
b00d() sync; // //# b00d: compile-time error
}
class C extends B {
C();
factory C.e1() async { return null; } // //# e1: compile-time error
factory C.e2() async* { return null; } // //# e2: compile-time error
factory C.e3() sync* { return null; } // //# e3: compile-time error
factory C.e4() async = C; // //# e4: compile-time error
factory C.e5() async* = C; // //# e5: compile-time error
factory C.e6() sync* = C; // //# e6: compile-time error
C.e7() async {} // //# e7: compile-time error
C.e8() async* {} // //# e8: compile-time error
C.e9() sync* {} // //# e9: compile-time error
b00a() {} // //# b00a: continued
b00b() {} // //# b00b: continued
b00c() {} // //# b00c: continued
b00d() {} // //# b00d: continued
b01a() async => null; // //# b01a: ok
b01b() async* => null; // //# b01b: compile-time error
b01c() sync* => null; // //# b01c: compile-time error
b02a() async {} // //# b02a: ok
b03a() async* {} // //# b03a: ok
b04a() sync* {} // //# b04a: ok
b04b() sync {} // //# b04b: compile-time error
b05a() async { await 0; } // //# b05a: ok
b06a() async { await for (var o in st) {} } // //# b06a: ok
b06b() async { await for ( ; ; ) {} } // //# b06b: compile-time error
b07a() sync* { yield 0; } // //# b07a: ok
b08a() sync* { yield* []; } // //# b08a: ok
b09a() async* { yield 0; } // //# b09a: ok
b10a() async* { yield* []; } // //# b10a: static type warning
b10b() async { yield 0; } // //# b10b: compile-time error
get sync sync {} // //# b11a: compile-time error
get sync sync* {} // //# b11b: ok
get async async {} // //# b11c: ok
get async async* {} // //# b11d: ok
get sync {} // //# b12a: ok
get sync* {} // //# b12b: compile-time error
get async {} // //# b12c: ok
get async* {} // //# b12d: compile-time error
get b12e sync* => null; // //# b12e: compile-time error
get b12f async* => null; // //# b12f: compile-time error
get b12g async => null; // //# b12g: ok
int sync; // //# b13a: ok
int sync*; // //# b13b: compile-time error
int async; // //# b13c: ok
int async*; // //# b13d: compile-time error
var sync; // //# b14a: ok
var sync*; // //# b14b: compile-time error
var async; // //# b14c: ok
var async*; // //# b14d: compile-time error
sync() {} // //# b15a: ok
sync*() {} // //# b15b: compile-time error
async() {} // //# b15c: ok
async*() {} // //# b15d: compile-time error
}
method1() {
c01a() async => null; c01a(); // //# c01a: ok
c01b() async* => null; c01b(); // //# c01b: compile-time error
c01c() sync* => null; c01c(); // //# c01c: compile-time error
c02a() async {} c02a(); // //# c02a: ok
c03a() async* {} c03a(); // //# c03a: ok
c04a() sync* {} c04a(); // //# c04a: ok
c04b() sync {} c04b(); // //# c04b: compile-time error
c05a() async { await 0; } c05a(); // //# c05a: ok
c06a() async { await for (var o in st) {} } c06a(); // //# c06a: ok
c07a() sync* { yield 0; } c07a(); // //# c07a: ok
c08a() sync* { yield* []; } c08a(); // //# c08a: ok
c09a() async* { yield 0; } c09a(); // //# c09a: ok
c10a() async* { yield* []; } c10a(); // //# c10a: static type warning
c11a() async { yield -5; } c11a(); // //# c11a: compile-time error
c11b() async { yield* st; } c11b(); // //# c11b: compile-time error
}
method2() {
var d01a = () async => null; d01a(); // //# d01a: ok
var d01b = () async* => null; d01b(); // //# d01b: compile-time error
var d01c = () sync* => null; d01c(); // //# d01c: compile-time error
var d02a = () async {}; d02a(); // //# d02a: ok
var d03a = () async* {}; d03a(); // //# d03a: ok
var d04a = () sync* {}; d04a(); // //# d04a: ok
var d04b = () sync {}; d04b(); // //# d04b: compile-time error
var d05a = () async { await 0; }; d05a(); // //# d05a: ok
var d06a = () async { await for (var o in st) {} }; d06a(); // //# d06a: ok
var d07a = () sync* { yield 0; }; d07a(); // //# d07a: ok
var d08a = () sync* { yield* []; }; d08a(); // //# d08a: ok
var d08b = () sync* { yield*0+1; }; d08b(); // //# d08b: static type warning
var d08c = () { yield*0+1; }; d08c(); // //# d08c: ok
var d09a = () async* { yield 0; }; d09a(); // //# d09a: ok
var d10a = () async* { yield* []; }; d10a(); // //# d10a: static type warning
}
void main() {
var a;
var c = new C();
c = new C.e1(); //# e1: continued
c = new C.e2(); //# e2: continued
c = new C.e3(); //# e3: continued
c = new C.e4(); //# e4: continued
c = new C.e5(); //# e5: continued
c = new C.e6(); //# e6: continued
c = new C.e7(); //# e7: continued
c = new C.e8(); //# e8: continued
c = new C.e9(); //# e9: continued
a01a(); // //# a01a: continued
a01b(); // //# a01b: continued
a01c(); // //# a01c: continued
a01d(); // //# a01d: continued
a02a(); // //# a02a: continued
a03a(); // //# a03a: continued
a03b(); // //# a03b: continued
a04a(); // //# a04a: continued
a04b(); // //# a04b: continued
a04c(); // //# a04c: continued
a05a(); // //# a05a: continued
a05b(); // //# a05b: continued
a05c(); // //# a05c: continued
a05d(); // //# a05d: continued
a05e(); // //# a05e: continued
a05f(); // //# a05f: continued
a05g(); // //# a05g: continued
a05h(); // //# a05h: continued
a06a(); // //# a06a: continued
a06b(); // //# a06b: continued
a07a(); // //# a07a: continued
a07b(); // //# a07b: continued
a08a(); // //# a08a: continued
a08b(); // //# a08b: continued
a09a(); // //# a09a: continued
a10a(); // //# a10a: continued
a = sync; // //# a11a: continued
a = sync; // //# a11b: continued
a = async; // //# a11c: continued
a = async; // //# a11d: continued
a = sync; // //# a12a: continued
a = sync; // //# a12b: continued
a = async; // //# a12c: continued
a = async; // //# a12d: continued
a = a12e; // //# a12e: continued
a = a12f; // //# a12f: continued
a = a12g; // //# a12g: continued
a = sync; // //# a13a: continued
a = sync; // //# a13b: continued
a = async; // //# a13c: continued
a = async; // //# a13d: continued
a = sync; // //# a14a: continued
a = sync; // //# a14b: continued
a = async; // //# a14c: continued
a = async; // //# a14d: continued
sync(); // //# a15a: continued
sync(); // //# a15b: continued
async(); // //# a15c: continued
async(); // //# a15d: continued
c.b00a(); // //# b00a: continued
c.b00b(); // //# b00b: continued
c.b00c(); // //# b00c: continued
c.b00d(); // //# b00d: continued
c.b01a(); // //# b01a: continued
c.b01b(); // //# b01b: continued
c.b01c(); // //# b01c: continued
c.b02a(); // //# b02a: continued
c.b03a(); // //# b03a: continued
c.b04a(); // //# b04a: continued
c.b04b(); // //# b04b: continued
c.b05a(); // //# b05a: continued
c.b06a(); // //# b06a: continued
c.b06b(); // //# b06b: continued
c.b07a(); // //# b07a: continued
c.b08a(); // //# b08a: continued
c.b09a(); // //# b09a: continued
c.b10a(); // //# b10a: continued
c.b10b(); // //# b10b: continued
a = c.sync; // //# b11a: continued
a = c.sync; // //# b11b: continued
a = c.async; // //# b11c: continued
a = c.async; // //# b11d: continued
a = c.sync; // //# b12a: continued
a = c.sync; // //# b12b: continued
a = c.async; // //# b12c: continued
a = c.async; // //# b12d: continued
a = c.b12e; // //# b12e: continued
a = c.b12f; // //# b12f: continued
a = c.b12g; // //# b12g: continued
a = c.sync; // //# b13a: continued
a = c.sync; // //# b13b: continued
a = c.async; // //# b13c: continued
a = c.async; // //# b13d: continued
a = c.sync; // //# b14a: continued
a = c.sync; // //# b14b: continued
a = c.async; // //# b14c: continued
a = c.async; // //# b14d: continued
c.sync(); // //# b15a: continued
c.sync(); // //# b15b: continued
c.async(); // //# b15c: continued
c.async(); // //# b15d: continued
method1();
method2();
}

View file

@ -0,0 +1,18 @@
// Copyright (c) 2014, 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.
import 'dart:async';
import 'async_helper_lib.dart' as async;
class A {
async.async get async => null;
}
async.async topLevel() => null;
main() {
var a = new A();
var b = a.async;
var c = topLevel();
}

View file

@ -0,0 +1,17 @@
// Copyright (c) 2014, 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.
int get async {
return 1;
}
class A {
async() => null;
}
main() {
var a = async;
var b = new A();
var c = b.async();
}

View file

@ -0,0 +1,54 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
then43() async {
label:
try {
return await 42;
} finally {
break label;
}
return await 43;
}
then42() async {
label:
try {
return await 42;
} finally {}
return await 43;
}
now43() {
label:
try {
return 42;
} finally {
break label;
}
return 43;
}
now42() {
label:
try {
return 42;
} finally {}
return 43;
}
test() async {
Expect.equals(42, await then42());
Expect.equals(43, await then43());
Expect.equals(42, now42());
Expect.equals(43, now43());
}
main() {
asyncStart();
test().then((_) => asyncEnd());
}

View file

@ -0,0 +1,116 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
// Two loop variables
test1() async {
var r = 0;
label:
for (var i = 1,
j =
await //# await_in_init: ok
10;
i < 10 &&
j >
await //# await_in_condition: ok
-5;
j--,
i +=
await //# await_in_update: ok
1) {
if (i <
await //# await_in_body: ok
5 ||
j < -5) {
continue label;
}
r++;
}
Expect.equals(5, r);
}
// One loop variable
test2() async {
var r = 0;
label:
for (var i =
await //# await_in_init: ok
0;
i <
await //# await_in_condition: ok
10;
i +=
await //# await_in_update: ok
1) {
if (i <
await //# await_in_body: ok
5) {
continue label;
}
r++;
}
Expect.equals(5, r);
}
// Variable not declared in initializer;
test3() async {
var r = 0, i, j;
label:
for (i =
await //# await_in_init: ok
0;
i <
await //# await_in_condition: ok
10;
i +=
await //# await_in_update: ok
1) {
if (i <
await //# await_in_body: ok
5) {
continue label;
}
r++;
}
Expect.equals(5, r);
}
// Nested loop
test4() async {
var r = 0;
label:
for (var i =
await //# await_in_init: ok
0;
i <
await //# await_in_condition: ok
10;
i +=
await //# await_in_update: ok
1) {
if (i <
await //# await_in_body: ok
5) {
for (int i = 0; i < 10; i++) {
continue label;
}
}
r++;
}
Expect.equals(5, r);
}
test() async {
await test1();
await test2();
await test3();
await test4();
}
main() {
asyncStart();
test().then((_) => asyncEnd());
}

View file

@ -0,0 +1,97 @@
// Copyright (c) 2014, 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.
// VMOptions=--optimization-counter-threshold=10
import 'package:expect/expect.dart';
import 'dart:async';
expectThenValue(future, value) {
Expect.isTrue(future is Future);
future.then((result) {
Expect.equals(value, result);
});
}
asyncIf(condition) async {
if (condition) {
return 1;
} else {
return 2;
}
// This return is never reached as the finally block returns from the
// function.
return 3;
}
asyncFor(condition) async {
for (int i = 0; i < 10; i++) {
if (i == 5 && condition) {
return 1;
}
}
return 2;
}
asyncTryCatchFinally(overrideInFinally, doThrow) async {
try {
if (doThrow) throw 444;
return 1;
} catch (e) {
return e;
} finally {
if (overrideInFinally) return 3;
}
}
asyncTryCatchLoop() async {
var i = 0;
var throws = 13;
while (true) {
try {
throw throws;
} catch (e) {
if (i == throws) {
return e;
}
} finally {
i++;
}
}
}
asyncImplicitReturn() async {
try {} catch (e) {} finally {}
}
main() {
var asyncReturn;
for (int i = 0; i < 10; i++) {
asyncReturn = asyncIf(true);
expectThenValue(asyncReturn, 1);
asyncReturn = asyncIf(false);
expectThenValue(asyncReturn, 2);
asyncReturn = asyncFor(true);
expectThenValue(asyncReturn, 1);
asyncReturn = asyncFor(false);
expectThenValue(asyncReturn, 2);
asyncReturn = asyncTryCatchFinally(true, false);
expectThenValue(asyncReturn, 3);
asyncReturn = asyncTryCatchFinally(false, false);
expectThenValue(asyncReturn, 1);
asyncReturn = asyncTryCatchFinally(true, true);
expectThenValue(asyncReturn, 3);
asyncReturn = asyncTryCatchFinally(false, true);
expectThenValue(asyncReturn, 444);
asyncReturn = asyncTryCatchLoop();
expectThenValue(asyncReturn, 13);
asyncReturn = asyncImplicitReturn();
expectThenValue(asyncReturn, null);
}
}

View file

@ -0,0 +1,28 @@
// Copyright (c) 2015, 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.
import "dart:async";
import "package:expect/expect.dart";
foo() async {
try {
await 1;
throw "error";
} on String catch (e) {
await 2;
throw e;
} finally {
await 3;
}
}
main() async {
var error = "no error";
try {
await foo();
} catch (e) {
error = e;
}
Expect.equals("error", error);
}

View file

@ -0,0 +1,7 @@
// Copyright (c) 2014, 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.
library async;
class async {}

View file

@ -0,0 +1,35 @@
// Copyright (c) 2015, 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.
import "package:expect/expect.dart";
void badReturnTypeAsync() async {} // //# 01: static type warning
void badReturnTypeAsyncStar() async* {} // //# 02: static type warning
void badReturnTypeSyncStar() sync* {} // //# 03: static type warning
main() {
try {
badReturnTypeAsync(); // //# 01: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeAsync"), "missing frame");
}
try {
badReturnTypeAsyncStar(); // //# 02: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeAsyncStar"), "missing frame");
}
try {
badReturnTypeSyncStar(); // //# 03: continued
} catch (e, st) {
Expect.isTrue(e is TypeError, "wrong exception type");
Expect.isTrue(
st.toString().contains("badReturnTypeSyncStar"), "missing frame");
}
}

View file

@ -0,0 +1,36 @@
// Copyright (c) 2015, 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.
// Regression test for issue 23058.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
class A {
var x = new B();
foo() async {
return x.foo == 2 ? 42 : x.foo;
}
}
class B {
var x = 0;
get foo {
if (x == -1) {
return 0;
} else {
return x++;
}
}
}
main() {
asyncStart();
new A().foo().then((result) {
Expect.equals(1, result);
asyncEnd();
});
}

Some files were not shown because too many files have changed in this diff Show more