| # Copyright (c) 2023, 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. |
| |
| # Reproduce the crash in https://github.com/flutter/flutter/issues/124369. |
| |
| type: newworld |
| worlds: |
| - entry: main.dart |
| sources: |
| main.dart: | |
| import 'dart:ffi'; |
| import 'lib.dart'; |
| import 'lib2.dart'; |
| class Foo implements Bar { |
| const Foo({required this.bar}); |
| final HelperClass bar; |
| } |
| abstract class Bar { |
| const factory Bar({required HelperClass bar}) = Foo; |
| } |
| class HelperClass implements Finalizable {} |
| lib.dart: | |
| class FooX implements BarX { |
| const FooX({required this.bar}); |
| final HelperClassX bar; |
| } |
| abstract class BarX { |
| const factory BarX({required HelperClassX bar}) = FooX; |
| } |
| class HelperClassX {} |
| lib2.dart: | |
| import "main.dart"; |
| import "lib.dart"; |
| void baz() { |
| Bar bar = new Bar(bar: new HelperClass()); |
| print(bar); |
| BarX barX = new BarX(bar: new HelperClassX()); |
| print(barX); |
| } |
| expectedLibraryCount: 3 |
| |
| # By having `worldType: updated` we force loading from "memory kernel". |
| - entry: main.dart |
| worldType: updated |
| compareWithFromScratch: true |
| expectInitializeFromDill: false |
| invalidate: |
| - main.dart |
| expectedLibraryCount: 3 |
| advancedInvalidation: importsFfi |
| |
| # By having `worldType: updated` we force loading from "memory kernel". |
| # By invalidating lib2.dart we ensure we can use the redirecting factory that |
| # is "from dill". |
| - entry: main.dart |
| worldType: updated |
| compareWithFromScratch: true |
| expectInitializeFromDill: false |
| invalidate: |
| - lib2.dart |
| expectedLibraryCount: 3 |
| advancedInvalidation: bodiesOnly |
| |
| # By *NOT* having `worldType: updated` we force loading from |
| # "serialized kernel". |
| # By invalidating lib2.dart we ensure we can use the redirecting factory that |
| # is "from dill". |
| - entry: main.dart |
| expectInitializeFromDill: true |
| compareWithFromScratch: true |
| invalidate: |
| - lib2.dart |
| sources: |
| main.dart: | |
| import 'dart:ffi'; |
| import 'lib.dart'; |
| import 'lib2.dart'; |
| class Foo implements Bar { |
| const Foo({required this.bar}); |
| final HelperClass bar; |
| } |
| abstract class Bar { |
| const factory Bar({required HelperClass bar}) = Foo; |
| } |
| class HelperClass implements Finalizable {} |
| lib.dart: | |
| class FooX implements BarX { |
| const FooX({required this.bar}); |
| final HelperClassX bar; |
| } |
| abstract class BarX { |
| const factory BarX({required HelperClassX bar}) = FooX; |
| } |
| class HelperClassX {} |
| lib2.dart: | |
| import "main.dart"; |
| import "lib.dart"; |
| void baz() { |
| Bar bar = new Bar(bar: new HelperClass()); |
| print(bar); |
| BarX barX = new BarX(bar: new HelperClassX()); |
| print(barX); |
| } |
| expectedLibraryCount: 3 |
| advancedInvalidation: bodiesOnly |