dart-sdk/tests/language/import/internal_library_test.dart
Johnni Winther 6a249fdcb0 [cfe] Include import paths in error for unavailable dart: libraries
This special-cases the error for importing/exporting dart: libraries
that are not available on the current platform and includes a detail
description of how the unavailable library was imported in the
context of the error message.

Currently there is no special casing of the message depending on the
unavailable library and the current platform, as this is meant as
a catch-all message. In a follow-up I'll add special casing of the
message for some of these cases.

In response to https://github.com/dart-lang/sdk/issues/47260

Change-Id: Ia296f9ca1b03bf664e12241a139970ef31c8a2d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261821
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-08 14:54:17 +00:00

31 lines
1.1 KiB
Dart

// 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 that a private library cannot be accessed from outside the platform.
library internal_library_test;
import 'dart:core'; // This loads 'dart:_foreign_helper' and 'patch:core'.
import 'dart:_foreign_helper';
// ^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.IMPORT_INTERNAL_LIBRARY
// [cfe] Can't access platform private library.
// [cfe] Dart library 'dart:_foreign_helper' is not available on this platform.
part 'dart:_foreign_helper';
// ^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.PART_OF_NON_PART
// [cfe] Can't access platform private library.
// [cfe] Can't use 'org-dartlang-untranslatable-uri:dart%3A_foreign_helper' as a part, because it has no 'part of' declaration.
// [cfe] Dart library 'dart:_foreign_helper' is not available on this platform.
void main() {
JS('int', '0');
//^
// [cfe] Method not found: 'JS'.
JS('int', '0');
//^
// [cfe] Method not found: 'JS'.
}