Skip to content

Commit

Permalink
Version 3.4.0-23.0.dev
Browse files Browse the repository at this point in the history
Merge ac5e3d3 into dev
  • Loading branch information
Dart CI committed Jan 12, 2024
2 parents 042dbc1 + ac5e3d3 commit 82fde5c
Show file tree
Hide file tree
Showing 56 changed files with 236 additions and 283 deletions.
75 changes: 50 additions & 25 deletions pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -714,63 +714,88 @@ final MockSdkLibrary _LIB_FFI = MockSdkLibrary('ffi', [
@Since('2.6')
library dart.ffi;
final class NativeType {
const NativeType();
}
abstract final class NativeType {}
@Since('3.4')
abstract final class SizedNativeType implements NativeType {}
@Since('2.9')
abstract final class Handle extends NativeType {}
abstract final class Handle implements NativeType {}
@Since('2.12')
abstract base class Opaque extends NativeType {}
abstract base class Opaque implements NativeType {}
final class Void extends NativeType {}
final class Void implements NativeType {}
final class Int8 extends NativeType {
final class Int8 implements SizedNativeType {
const Int8();
}
final class Uint8 extends NativeType {
final class Uint8 implements SizedNativeType {
const Uint8();
}
final class Int16 extends NativeType {
final class Int16 implements SizedNativeType {
const Int16();
}
final class Uint16 extends NativeType {
final class Uint16 implements SizedNativeType {
const Uint16();
}
final class Int32 extends NativeType {
final class Int32 implements SizedNativeType {
const Int32();
}
final class Uint32 extends NativeType {
final class Uint32 implements SizedNativeType {
const Uint32();
}
final class Int64 extends NativeType {
final class Int64 implements SizedNativeType {
const Int64();
}
final class Uint64 extends NativeType {
final class Uint64 implements SizedNativeType {
const Uint64();
}
final class Float extends NativeType {
final class Float implements SizedNativeType {
const Float();
}
final class Double extends NativeType {
final class Double implements SizedNativeType {
const Double();
}
final class IntPtr extends NativeType {
@AbiSpecificIntegerMapping({
Abi.androidArm: Int32(),
Abi.androidArm64: Int64(),
Abi.androidIA32: Int32(),
Abi.androidX64: Int64(),
Abi.androidRiscv64: Int64(),
Abi.fuchsiaArm64: Int64(),
Abi.fuchsiaX64: Int64(),
Abi.fuchsiaRiscv64: Int64(),
Abi.iosArm: Int32(),
Abi.iosArm64: Int64(),
Abi.iosX64: Int64(),
Abi.linuxArm: Int32(),
Abi.linuxArm64: Int64(),
Abi.linuxIA32: Int32(),
Abi.linuxX64: Int64(),
Abi.linuxRiscv32: Int32(),
Abi.linuxRiscv64: Int64(),
Abi.macosArm64: Int64(),
Abi.macosX64: Int64(),
Abi.windowsArm64: Int64(),
Abi.windowsIA32: Int32(),
Abi.windowsX64: Int64(),
})
final class IntPtr extends AbiSpecificInteger {
const IntPtr();
}
final class Pointer<T extends NativeType> extends NativeType {
final class Pointer<T extends NativeType> implements SizedNativeType {
external factory Pointer.fromAddress(int ptr);
static Pointer<NativeFunction<T>> fromFunction<T extends Function>(
Expand All @@ -797,13 +822,13 @@ extension NativeFunctionPointer<NF extends Function>
external DF asFunction<DF extends Function>({bool isLeaf = false});
}
final class _Compound extends NativeType {}
final class _Compound implements SizedNativeType {}
@Since('2.12')
base class Struct extends _Compound {}
abstract base class Struct extends _Compound {}
@Since('2.14')
base class Union extends _Compound {}
abstract base class Union extends _Compound {}
@Since('2.13')
final class Packed {
Expand All @@ -823,14 +848,14 @@ extension DynamicLibraryExtension on DynamicLibrary {
String symbolName, {bool isLeaf:false});
}
abstract final class NativeFunction<T extends Function> extends NativeType {}
abstract final class NativeFunction<T extends Function> implements NativeType {}
final class DartRepresentationOf {
const DartRepresentationOf(String nativeType);
}
@Since('2.13')
final class Array<T extends NativeType> extends NativeType {
final class Array<T extends NativeType> implements NativeType {
const factory Array(int dimension1,
[int dimension2,
int dimension3,
Expand Down Expand Up @@ -930,7 +955,7 @@ enum _OS {
}
@Since('2.16')
base class AbiSpecificInteger extends NativeType {
base class AbiSpecificInteger implements SizedNativeType {
const AbiSpecificInteger();
}
Expand All @@ -952,7 +977,7 @@ abstract interface class Finalizable {
}
@Since('3.0')
abstract final class VarArgs<T extends Record> extends NativeType {}
abstract final class VarArgs<T extends Record> implements NativeType {}
''',
)
]);
Expand Down
16 changes: 2 additions & 14 deletions pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ import 'dart:ffi';
class C with Double {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 6),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 6),
]);
}

Expand All @@ -369,7 +368,6 @@ import 'dart:ffi';
class C with Double {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 46, 6),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 46, 6),
]);
}

Expand All @@ -379,7 +377,6 @@ import 'dart:ffi' as ffi;
class C with ffi.Double {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 39, 10),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 39, 10),
]);
}

Expand All @@ -389,7 +386,6 @@ import 'dart:ffi';
class C with Float {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 5),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5),
]);
}

Expand All @@ -399,7 +395,6 @@ import 'dart:ffi';
class C with Int16 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 5),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5),
]);
}

Expand All @@ -409,7 +404,6 @@ import 'dart:ffi';
class C with Int32 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 5),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5),
]);
}

Expand All @@ -419,7 +413,6 @@ import 'dart:ffi';
class C with Int64 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 5),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5),
]);
}

Expand All @@ -429,7 +422,6 @@ import 'dart:ffi';
class C with Int8 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 4),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 4),
]);
}

Expand All @@ -438,7 +430,7 @@ class C with Int8 {}
import 'dart:ffi';
class C with Pointer {}
''', [
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 7),
error(CompileTimeErrorCode.CLASS_USED_AS_MIXIN, 32, 7),
]);
}

Expand All @@ -457,7 +449,6 @@ import 'dart:ffi';
class C with Uint16 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 6),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 6),
]);
}

Expand All @@ -467,7 +458,6 @@ import 'dart:ffi';
class C with Uint32 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 6),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 6),
]);
}

Expand All @@ -477,7 +467,6 @@ import 'dart:ffi';
class C with Uint64 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 6),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 6),
]);
}

Expand All @@ -487,7 +476,6 @@ import 'dart:ffi';
class C with Uint8 {}
''', [
error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 32, 5),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5),
]);
}

Expand All @@ -505,7 +493,7 @@ final class C with Union {}
import 'dart:ffi';
class C with Void {}
''', [
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 4),
error(CompileTimeErrorCode.CLASS_USED_AS_MIXIN, 32, 4),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ void runAgnosticSharedTestsShard1(
List<int> list = [];
list.add(0);
// Breakpoint: bp
print(list);
}
''';

Expand Down Expand Up @@ -854,7 +855,7 @@ void runAgnosticSharedTestsShard1(
await driver.checkInFrame(
breakpointId: 'bp',
expression: 'typo',
expectedError: "Error: Undefined name 'typo'");
expectedError: "Error: The getter 'typo' isn't defined");
});

test('local (trimmed scope)', () async {
Expand All @@ -863,13 +864,8 @@ void runAgnosticSharedTestsShard1(
});

test('this (full scope)', () async {
// Note: this currently fails due to
// - incremental compiler not mapping 'this' from user input to '#this'
// - incremental compiler not allowing #this as a parameter name
await driver.checkInFrame(
breakpointId: 'bp',
expression: 'this',
expectedError: "Error: Expected identifier, but got 'this'");
breakpointId: 'bp', expression: 'this', expectedResult: '1234');
});

test('scope', () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:26:7: Error: The superclass, 'Finalizable', has no unnamed constructor that takes no arguments.
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:26:7: Error: The superclass, 'Finalizable', has no unnamed constructor that takes no arguments.
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:26:7: Error: The superclass, 'Finalizable', has no unnamed constructor that takes no arguments.
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:26:7: Error: The superclass, 'Finalizable', has no unnamed constructor that takes no arguments.
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
import self as self;
import "dart:core" as core;
import "dart:ffi" as ffi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ library;
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:11:22: Error: The class 'Double' can't be used as a mixin because it extends a class other than 'Object'.
// class WithFinal with Double {} /* Error */
// ^
//
// pkg/front_end/testcases/class_modifiers/ffi_exception.dart:26:7: Error: The superclass, 'Finalizable', has no unnamed constructor that takes no arguments.
// class ExtendsInterface extends Finalizable {} /* Error */
// ^
Expand Down
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/general/ffi_sample.dart.strong.expect
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static method main() → dynamic {}
constants {
#C1 = "vm:ffi:struct-fields"
#C2 = TypeLiteralConstant(ffi::Double)
#C3 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
#C3 = TypeLiteralConstant(ffi::Pointer<core::Object>)
#C4 = <core::Type>[#C2, #C2, #C3]
#C5 = null
#C6 = ffi::_FfiStructLayout {fieldTypes:#C4, packing:#C5}
Expand All @@ -82,6 +82,4 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
Loading

0 comments on commit 82fde5c

Please sign in to comment.