Skip to content

Commit

Permalink
Version 3.3.0-142.0.dev
Browse files Browse the repository at this point in the history
Merge 56a86e5 into dev
  • Loading branch information
Dart CI committed Nov 16, 2023
2 parents 5cccc24 + 56a86e5 commit b512191
Show file tree
Hide file tree
Showing 10 changed files with 794 additions and 46 deletions.
20 changes: 14 additions & 6 deletions pkg/dev_compiler/test/id_testing_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/api_prototype/experimental_flags.dart' as fe;
import 'package:front_end/src/fasta/messages.dart';
import 'package:front_end/src/testing/id_extractor.dart';
import 'package:front_end/src/testing/kernel_id_testing.dart';
Expand All @@ -12,7 +13,13 @@ import 'package:kernel/ast.dart';
import 'memory_compiler.dart';

/// Test configuration used for testing CFE in its default state.
const TestConfig defaultDdcConfig = TestConfig(ddcMarker, 'ddc');
const DdcTestConfig defaultDdcConfig = DdcTestConfig(ddcMarker, 'ddc');

class DdcTestConfig extends TestConfig {
final Map<fe.ExperimentalFlag, bool>? experimentalFlags;

const DdcTestConfig(super.marker, super.name, {this.experimentalFlags});
}

/// Convert relative file paths into an absolute Uri as expected by the test
/// helpers above.
Expand Down Expand Up @@ -42,7 +49,7 @@ abstract class DdcDataComputer<T> extends DataComputer<T, TestConfig,

/// Creates a test runner for [dataComputer] on [testedConfigs].
RunTestFunction<T> runTestFor<T>(
DdcDataComputer<T> dataComputer, List<TestConfig> testedConfigs) {
DdcDataComputer<T> dataComputer, List<DdcTestConfig> testedConfigs) {
return (MarkerOptions markerOptions, TestData testData,
{required bool testAfterFailures,
required bool verbose,
Expand All @@ -66,7 +73,7 @@ Future<Map<String, TestResult<T>>> runTest<T>(
MarkerOptions markerOptions,
TestData testData,
DdcDataComputer<T> dataComputer,
List<TestConfig> testedConfigs,
List<DdcTestConfig> testedConfigs,
{required bool testAfterFailures,
required bool verbose,
required bool succinct,
Expand All @@ -93,7 +100,7 @@ Future<Map<String, TestResult<T>>> runTest<T>(
/// Computes the [TestResult] for running [dataComputer] on [testData] for
/// the given test [config].
Future<TestResult<T>> runTestForConfig<T>(MarkerOptions markerOptions,
TestData testData, DdcDataComputer<T> dataComputer, TestConfig config,
TestData testData, DdcDataComputer<T> dataComputer, DdcTestConfig config,
{required bool fatalErrors,
required bool verbose,
required bool succinct,
Expand All @@ -102,8 +109,9 @@ Future<TestResult<T>> runTestForConfig<T>(MarkerOptions markerOptions,
Iterable<Id> globalIds = const <Id>[],
required void Function(String message) onFailure,
required Uri nullUri}) async {
var result =
await compileFromMemory(testData.memorySourceFiles, testData.entryPoint);
var result = await compileFromMemory(
testData.memorySourceFiles, testData.entryPoint,
explicitExperimentalFlags: config.experimentalFlags);

var errors = <FormattedMessage>[];
for (var error in result.errors) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/dev_compiler/test/memory_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Uri memoryDirectory = Uri.parse('memory://');
/// be absolute, using [memoryDirectory] as base uri to refer to a file from
/// [memoryFiles].
Future<MemoryCompilerResult> compileFromMemory(
Map<String, String> memoryFiles, Uri entryPoint) async {
Map<String, String> memoryFiles, Uri entryPoint,
{Map<fe.ExperimentalFlag, bool>? explicitExperimentalFlags}) async {
var errors = <fe.DiagnosticMessage>[];
void diagnosticMessageHandler(fe.DiagnosticMessage message) {
if (message.severity == fe.Severity.error) {
Expand Down Expand Up @@ -61,6 +62,7 @@ Future<MemoryCompilerResult> compileFromMemory(
TargetFlags(trackWidgetCreation: false, soundNullSafety: true)),
fileSystem: fe.HybridFileSystem(memoryFileSystem),
environmentDefines: {},
explicitExperimentalFlags: explicitExperimentalFlags,
nnbdMode: fe.NnbdMode.Strong);
var result =
await fe.compile(compilerState, [entryPoint], diagnosticMessageHandler);
Expand Down
8 changes: 6 additions & 2 deletions pkg/dev_compiler/test/scopes/scope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'dart:io' show Directory, Platform;
import 'package:_fe_analyzer_shared/src/testing/features.dart';
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
show DataInterpreter, ddcMarker, runTests;
import 'package:front_end/src/api_prototype/experimental_flags.dart' as fe;
import 'package:kernel/ast.dart';
import 'package:kernel/dart_scope_calculator.dart';

Expand All @@ -20,7 +21,10 @@ Future<void> main(List<String> args) async {
args: args,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const ScopeDataComputer(), [defaultDdcConfig]));
runTest: runTestFor(const ScopeDataComputer(), [
DdcTestConfig(ddcMarker, 'ddc',
experimentalFlags: {fe.ExperimentalFlag.inlineClass: true})
]));
}

class Tags {
Expand Down
Loading

0 comments on commit b512191

Please sign in to comment.