Version 2.15.0-191.0.dev
Merge commit '24a73187257aca517cbfa3872ba467b9cc3c0118' into 'dev'
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 628175a..26d0396 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -573,7 +573,6 @@
HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER,
HintCode.INVALID_VISIBILITY_ANNOTATION,
HintCode.INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION,
- HintCode.MISSING_JS_LIB_ANNOTATION,
HintCode.MISSING_REQUIRED_PARAM,
HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS,
HintCode.MISSING_RETURN,
diff --git a/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart b/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
index aaa8ef5..cd2d918 100644
--- a/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
+++ b/pkg/analyzer/lib/src/dart/constant/potentially_constant.dart
@@ -330,9 +330,7 @@
var typeArguments = node.typeArguments?.arguments;
if (typeArguments != null && typeArguments.length == 1) {
var elementType = typeArguments[0];
- // TODO(srawlins): Change to "potentially" constant type expression as
- // per https://github.com/dart-lang/sdk/issues/47302?
- if (!isConstantTypeExpression(elementType)) {
+ if (!isPotentiallyConstantTypeExpression(elementType)) {
nodes.add(elementType);
}
}
@@ -347,9 +345,7 @@
var typeArguments = node.typeArguments?.arguments;
if (typeArguments != null && typeArguments.length == 1) {
var elementType = typeArguments[0];
- // TODO(srawlins): Change to "potentially" constant type expression as
- // per https://github.com/dart-lang/sdk/issues/47302?
- if (!isConstantTypeExpression(elementType)) {
+ if (!isPotentiallyConstantTypeExpression(elementType)) {
nodes.add(elementType);
}
}
@@ -406,10 +402,8 @@
}
return true;
}
- if (node.type is DynamicTypeImpl) {
- return true;
- }
- if (node.type is VoidType) {
+ var type = node.type;
+ if (type is DynamicTypeImpl || type is NeverType || type is VoidType) {
return true;
}
return false;
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
index 07f0e0e..12bbdcc 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -1493,16 +1493,6 @@
);
/**
- * Generate a hint for an element that is annotated with `@JS(...)` whose
- * library declaration is not similarly annotated.
- */
- static const HintCode MISSING_JS_LIB_ANNOTATION = HintCode(
- 'MISSING_JS_LIB_ANNOTATION',
- "The @JS() annotation can only be used if it is also declared on the library directive.",
- correctionMessage: "Try adding the annotation to the library directive.",
- );
-
- /**
* Generate a hint for a constructor, function or method invocation where a
* required parameter is missing.
*
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index ecedd89..647e36b 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -332,7 +332,6 @@
@override
void visitAnnotation(Annotation node) {
_checkForInvalidAnnotationFromDeferredLibrary(node);
- _checkForMissingJSLibAnnotation(node);
super.visitAnnotation(node);
}
@@ -3022,15 +3021,6 @@
}
}
- void _checkForMissingJSLibAnnotation(Annotation node) {
- if (node.elementAnnotation?.isJS ?? false) {
- if (_currentLibrary.hasJS != true) {
- errorReporter.reportErrorForNode(
- HintCode.MISSING_JS_LIB_ANNOTATION, node);
- }
- }
- }
-
/// Verify that the given mixin does not have an explicitly declared
/// constructor. The [mixinName] is the node to report problem on. The
/// [mixinElement] is the mixing to evaluate.
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 268f0cf..ed7de6a 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -15195,12 +15195,6 @@
```dart
class C {}
```
- MISSING_JS_LIB_ANNOTATION:
- problemMessage: The @JS() annotation can only be used if it is also declared on the library directive.
- correctionMessage: Try adding the annotation to the library directive.
- comment: |-
- Generate a hint for an element that is annotated with `@JS(...)` whose
- library declaration is not similarly annotated.
MISSING_REQUIRED_PARAM:
problemMessage: "The parameter '{0}' is required."
hasPublishedDocs: true
diff --git a/pkg/analyzer/test/src/dart/constant/potentially_constant_test.dart b/pkg/analyzer/test/src/dart/constant/potentially_constant_test.dart
index fc1371d..8a70510 100644
--- a/pkg/analyzer/test/src/dart/constant/potentially_constant_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/potentially_constant_test.dart
@@ -469,6 +469,19 @@
''', () => findNode.constructorReference('B<int>.new'));
}
+ test_constructorReference_explicitTypeArguments_nonConst() async {
+ await _assertNotConst('''
+import '' deferred as self;
+class A {
+ Object x;
+ const A(): x = B<self.A>.new;
+}
+
+class B<T> {}
+''', () => findNode.constructorReference('B<self.A>.new'),
+ () => [findNode.typeAnnotation('self.A')]);
+ }
+
test_constructorReference_noTypeArguments() async {
await _assertConst('''
class A {
@@ -491,6 +504,19 @@
''', () => findNode.functionReference('id<int>'));
}
+ test_functionReference_explicitTypeArguments_nonConst() async {
+ await _assertNotConst('''
+import '' deferred as self;
+class A {
+ final int Function(int) x;
+ const A(): x = id<self.A>;
+}
+
+X id<X>(X x) => x;
+''', () => findNode.functionReference('id<self.A>'),
+ () => [findNode.typeAnnotation('self.A')]);
+ }
+
test_functionReference_noTypeArguments() async {
await _assertConst('''
class A {
@@ -617,6 +643,24 @@
() => [findNode.simple('a,'), findNode.simple('b,')]);
}
+ test_listLiteral_ofDynamic() async {
+ await _assertConst('''
+var x = const <dynamic>[];
+''', () => _xInitializer());
+ }
+
+ test_listLiteral_ofNever() async {
+ await _assertConst('''
+var x = const <Never>[];
+''', () => _xInitializer());
+ }
+
+ test_listLiteral_ofVoid() async {
+ await _assertConst('''
+var x = const <void>[];
+''', () => _xInitializer());
+ }
+
test_listLiteral_typeArgument() async {
await _assertConst(r'''
var x = const <int>[0, 1, 2];
@@ -624,13 +668,14 @@
}
test_listLiteral_typeArgument_notConstType() async {
- await _assertNotConst(r'''
-class A<T> {
+ await _assertNotConst('''
+import '' deferred as self;
+class A {
m() {
- var x = const <T>[0, 1, 2];
+ var x = const <self.A>[];
}
}
-''', () => _xInitializer(), () => [findNode.namedType('T>[0')]);
+''', () => _xInitializer(), () => [findNode.namedType('A>[')]);
}
test_literal_bool() async {
@@ -1039,13 +1084,14 @@
}
test_setLiteral_typeArgument_notConstType() async {
- await _assertNotConst(r'''
-class A<T> {
+ await _assertNotConst('''
+import '' deferred as self;
+class A {
m() {
- var x = const <T>{0, 1, 2};
+ var x = const <self.A>{};
}
}
-''', () => _xInitializer(), () => [findNode.namedType('T>{0')]);
+''', () => _xInitializer(), () => [findNode.namedType('A>{')]);
}
test_simpleIdentifier_class() async {
@@ -1230,6 +1276,17 @@
''', () => findNode.typeLiteral('List<int>'));
}
+ test_typeLiteral_nonConst() async {
+ await _assertNotConst('''
+import '' deferred as self;
+class A {
+ Type x;
+ const A(): x = List<self.A>;
+}
+''', () => findNode.typeLiteral('List<self.A>'),
+ () => [findNode.typeAnnotation('self.A')]);
+ }
+
_assertConst(String code, AstNode Function() getNode) async {
await resolveTestCode(code);
var node = getNode();
diff --git a/pkg/analyzer/test/src/diagnostics/missing_js_lib_annotation_test.dart b/pkg/analyzer/test/src/diagnostics/missing_js_lib_annotation_test.dart
deleted file mode 100644
index 9f0346b..0000000
--- a/pkg/analyzer/test/src/diagnostics/missing_js_lib_annotation_test.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2019, 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:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/dart/error/syntactic_errors.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/context_collection_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(MissingJSLibAnnotationTest);
- defineReflectiveTests(MissingJSLibAnnotationWithoutNullSafetyTest);
- });
-}
-
-@reflectiveTest
-class MissingJSLibAnnotationTest extends PubPackageResolutionTest {
- @override
- void setUp() {
- super.setUp();
-
- writeTestPackageConfig(PackageConfigFileBuilder(), js: true);
- }
-
- test_class() async {
- await assertErrorsInCode('''
-library foo;
-
-import 'package:js/js.dart';
-
-@JS()
-class A { }
-''', [
- error(HintCode.MISSING_JS_LIB_ANNOTATION, 44, 5),
- ]);
- }
-
- test_function() async {
- await assertErrorsInCode('''
-library foo;
-
-import 'package:js/js.dart';
-
-@JS('acxZIndex')
-set _currentZIndex(int value) { }
-''', [
- error(HintCode.MISSING_JS_LIB_ANNOTATION, 44, 16),
- error(HintCode.UNUSED_ELEMENT, 65, 14),
- ]);
- }
-
- test_method() async {
- await assertErrorsInCode('''
-library foo;
-
-import 'package:js/js.dart';
-
-class A {
- @JS()
- void a() { }
-}
-''', [
- error(HintCode.MISSING_JS_LIB_ANNOTATION, 56, 5),
- ]);
- }
-
- test_notMissing() async {
- await assertNoErrorsInCode('''
-@JS()
-library foo;
-
-import 'package:js/js.dart';
-
-@JS()
-class A { }
-''');
- }
-
- test_variable() async {
- await assertErrorsInCode('''
-import 'package:js/js.dart';
-
-@JS()
-dynamic variable;
-''', [
- error(HintCode.MISSING_JS_LIB_ANNOTATION, 30, 5),
- ]);
- }
-}
-
-@reflectiveTest
-class MissingJSLibAnnotationWithoutNullSafetyTest
- extends PubPackageResolutionTest with WithoutNullSafetyMixin {
- @override
- void setUp() {
- super.setUp();
-
- writeTestPackageConfig(PackageConfigFileBuilder(), js: true);
- }
-
- test_externalField() async {
- // https://github.com/dart-lang/sdk/issues/26987
- await assertErrorsInCode('''
-import 'package:js/js.dart';
-
-@JS()
-external dynamic exports;
-''', [
- error(HintCode.MISSING_JS_LIB_ANNOTATION, 30, 5),
- error(ParserErrorCode.EXTERNAL_FIELD, 36, 8),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 33a5243..263958a 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -402,7 +402,6 @@
as missing_enum_constant_in_switch;
import 'missing_exception_value_test.dart' as missing_exception_value;
import 'missing_field_type_in_struct_test.dart' as missing_field_type_in_struct;
-import 'missing_js_lib_annotation_test.dart' as missing_js_lib_annotation;
import 'missing_required_param_test.dart' as missing_required_param;
import 'missing_return_test.dart' as missing_return;
import 'missing_size_annotation_carray_test.dart'
@@ -981,7 +980,6 @@
missing_enum_constant_in_switch.main();
missing_exception_value.main();
missing_field_type_in_struct.main();
- missing_js_lib_annotation.main();
missing_required_param.main();
missing_return.main();
missing_size_annotation_carray.main();
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc
index 8b5c402..3371314 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -319,8 +319,8 @@
char* str = StringUtils::ConsoleStringToUtf8(reinterpret_cast<char*>(buffer),
bytes_length, &len);
if (str == NULL) {
- Dart_ThrowException(
- DartUtils::NewInternalError("SystemEncodingToString failed"));
+ Dart_ThrowException(DartUtils::NewDartUnsupportedError(
+ "SystemEncodingToString not supported on this operating system"));
}
result = Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(str), len);
ThrowIfError(result);
@@ -338,8 +338,8 @@
const char* system_string =
StringUtils::Utf8ToConsoleString(utf8, utf8_len, &system_len);
if (system_string == NULL) {
- Dart_ThrowException(
- DartUtils::NewInternalError("StringToSystemEncoding failed"));
+ Dart_ThrowException(DartUtils::NewDartUnsupportedError(
+ "StringToSystemEncoding not supported on this operating system"));
}
uint8_t* buffer = NULL;
Dart_Handle external_array = IOBuffer::Allocate(system_len, &buffer);
diff --git a/runtime/bin/utils.h b/runtime/bin/utils.h
index 5f5a1cc..ab7b1c1 100644
--- a/runtime/bin/utils.h
+++ b/runtime/bin/utils.h
@@ -67,8 +67,8 @@
// character. If result_len is not NUL, it is used to set the number
// of characters in the result.
//
- // These conversion functions are only implemented on Windows as the
- // Dart code only hit this path on Windows.
+ // A return value of `nullptr` indicates that the conversion is not supported,
+ // which is true on all platforms other than Windows.
static const char* ConsoleStringToUtf8(const char* str,
intptr_t len = -1,
intptr_t* result_len = NULL);
diff --git a/runtime/bin/utils_android.cc b/runtime/bin/utils_android.cc
index 53a4cec..89002ab 100644
--- a/runtime/bin/utils_android.cc
+++ b/runtime/bin/utils_android.cc
@@ -43,28 +43,24 @@
const char* StringUtils::ConsoleStringToUtf8(const char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
const char* StringUtils::Utf8ToConsoleString(const char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::ConsoleStringToUtf8(char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::Utf8ToConsoleString(char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
diff --git a/runtime/bin/utils_fuchsia.cc b/runtime/bin/utils_fuchsia.cc
index f034e87..3053550 100644
--- a/runtime/bin/utils_fuchsia.cc
+++ b/runtime/bin/utils_fuchsia.cc
@@ -41,28 +41,24 @@
const char* StringUtils::ConsoleStringToUtf8(const char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
const char* StringUtils::Utf8ToConsoleString(const char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::ConsoleStringToUtf8(char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::Utf8ToConsoleString(char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc
index 9c9ad3a..5e18730 100644
--- a/runtime/bin/utils_linux.cc
+++ b/runtime/bin/utils_linux.cc
@@ -42,28 +42,24 @@
const char* StringUtils::ConsoleStringToUtf8(const char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
const char* StringUtils::Utf8ToConsoleString(const char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::ConsoleStringToUtf8(char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::Utf8ToConsoleString(char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc
index 219d643..d9f4f46 100644
--- a/runtime/bin/utils_macos.cc
+++ b/runtime/bin/utils_macos.cc
@@ -46,28 +46,24 @@
const char* StringUtils::ConsoleStringToUtf8(const char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
const char* StringUtils::Utf8ToConsoleString(const char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::ConsoleStringToUtf8(char* str,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
char* StringUtils::Utf8ToConsoleString(char* utf8,
intptr_t len,
intptr_t* result_len) {
- UNIMPLEMENTED();
return NULL;
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index 9355b01..20f828f 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -1622,12 +1622,7 @@
} else if (loc.IsFpuRegister()) {
// Check that a register is not specified twice in the summary.
const FpuRegister fpu_reg = loc.fpu_reg();
- if ((fpu_reg < 0) || (fpu_reg >= kNumberOfFpuRegisters)) {
- // Debug prints for https://github.com/dart-lang/sdk/issues/47314.
- OS::PrintErr("input(%" Pd ") fpu_reg = %d\n", i, fpu_reg);
- OS::PrintErr("instr = %s\n", instr->ToCString());
- UNREACHABLE();
- }
+ ASSERT((fpu_reg >= 0) && (fpu_reg < kNumberOfFpuRegisters));
ASSERT(!blocked_fpu_registers[fpu_reg]);
blocked_fpu_registers[fpu_reg] = true;
}
@@ -1642,12 +1637,7 @@
} else if (loc.IsFpuRegister()) {
// Check that a register is not specified twice in the summary.
const FpuRegister fpu_reg = loc.fpu_reg();
- if ((fpu_reg < 0) || (fpu_reg >= kNumberOfFpuRegisters)) {
- // Debug prints for https://github.com/dart-lang/sdk/issues/47314.
- OS::PrintErr("temp(%" Pd ") fpu_reg = %d\n", i, fpu_reg);
- OS::PrintErr("instr = %s\n", instr->ToCString());
- UNREACHABLE();
- }
+ ASSERT((fpu_reg >= 0) && (fpu_reg < kNumberOfFpuRegisters));
ASSERT(!blocked_fpu_registers[fpu_reg]);
blocked_fpu_registers[fpu_reg] = true;
}
diff --git a/tests/co19_2/co19_2-kernel.status b/tests/co19_2/co19_2-kernel.status
index 0ea8baf..6c9f37b 100644
--- a/tests/co19_2/co19_2-kernel.status
+++ b/tests/co19_2/co19_2-kernel.status
@@ -6,6 +6,8 @@
LanguageFeatures/Instantiate-to-bound/typedef/static/typedef_l2_06_t04: SkipByDesign # Won't fix. See https://github.com/dart-lang/sdk/issues/46288
[ $runtime == dart_precompiled ]
+Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Skip # https://github.com/dart-lang/co19/issues/1211
+Language/Libraries_and_Scripts/Scripts/top_level_main_t06: Skip # https://github.com/dart-lang/co19/issues/1211
LibTest/io/RawDatagramSocket/join_A01_t01: Skip # https://github.com/dart-lang/co19/issues/195
LibTest/io/RawDatagramSocket/join_A01_t02: Skip # https://github.com/dart-lang/co19/issues/195
LibTest/io/RawDatagramSocket/join_A02_t01: Skip # https://github.com/dart-lang/co19/issues/195
diff --git a/tests/standalone/io/issue_46436_test.dart b/tests/standalone/io/issue_46436_test.dart
new file mode 100644
index 0000000..9e64816
--- /dev/null
+++ b/tests/standalone/io/issue_46436_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2021, 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.
+//
+// Checks that _WindowsCodePageEncoder.convert() throws an exception on
+// platforms other than Windows.
+
+import "dart:io";
+import 'dart:mirrors';
+
+import "package:expect/expect.dart";
+
+ClassMirror findWindowsCodePageEncoder() {
+ final dartIo =
+ currentMirrorSystem().libraries[Uri(scheme: "dart", path: "io")];
+ if (dartIo == null) {
+ throw new StateError("dart:io not present");
+ }
+
+ final classes = dartIo.declarations.values
+ .where((d) =>
+ d is ClassMirror &&
+ d.simpleName.toString().contains('"_WindowsCodePageEncoder"'))
+ .map((d) => d as ClassMirror)
+ .toList();
+
+ Expect.equals(
+ 1, classes.length, "Expected exactly one _WindowsCodePageEncoder");
+ return classes[0];
+}
+
+test() {
+ final winCodePageEncoder = findWindowsCodePageEncoder();
+ final encoder = winCodePageEncoder.newInstance(Symbol(""), new List.empty());
+ try {
+ encoder.invoke(Symbol("convert"), List.of(["test"]));
+ Expect.isTrue(Platform.isWindows,
+ "expected UnsupportedError on ${Platform.operatingSystem}");
+ } on UnsupportedError catch (e) {
+ Expect.isFalse(
+ Platform.isWindows, "unexpected UnsupportedError on Windows: $e");
+ }
+}
+
+void main() {
+ test();
+}
diff --git a/tests/standalone_2/io/issue_46436_test.dart b/tests/standalone_2/io/issue_46436_test.dart
new file mode 100644
index 0000000..08b0110
--- /dev/null
+++ b/tests/standalone_2/io/issue_46436_test.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, 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.
+//
+// Checks that _WindowsCodePageEncoder.convert() throws an exception on
+// platforms other than Windows.
+
+// @dart = 2.9
+
+import "dart:io";
+import 'dart:mirrors';
+
+import "package:expect/expect.dart";
+
+ClassMirror findWindowsCodePageEncoder() {
+ final dartIo =
+ currentMirrorSystem().libraries[Uri(scheme: "dart", path: "io")];
+ if (dartIo == null) {
+ throw new StateError("dart:io not present");
+ }
+
+ final classes = dartIo.declarations.values
+ .where((d) =>
+ d is ClassMirror &&
+ d.simpleName.toString().contains('"_WindowsCodePageEncoder"'))
+ .map((d) => d as ClassMirror)
+ .toList();
+
+ Expect.equals(
+ 1, classes.length, "Expected exactly one _WindowsCodePageEncoder");
+ return classes[0];
+}
+
+test() {
+ final winCodePageEncoder = findWindowsCodePageEncoder();
+ final encoder = winCodePageEncoder.newInstance(Symbol(""), new List.empty());
+ try {
+ encoder.invoke(Symbol("convert"), List.of(["test"]));
+ Expect.isTrue(Platform.isWindows,
+ "expected UnsupportedError on ${Platform.operatingSystem}");
+ } on UnsupportedError catch (e) {
+ Expect.isFalse(
+ Platform.isWindows, "unexpected UnsupportedError on Windows: $e");
+ }
+}
+
+void main() {
+ test();
+}
diff --git a/tools/VERSION b/tools/VERSION
index 818d3bd..11a1a9c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 190
+PRERELEASE 191
PRERELEASE_PATCH 0
\ No newline at end of file