Description
import 'package:js/js.dart';
main() {
foo = allowInterop(() {
print("nja nja naj");
}
);
}
@JS
external set foo(Function f);
a@LinL460:/tmp/jstest/web$ dart2js main.dart -o main.dart.js
main.dart:12:2:
Error: A metadata annotation must be either a reference to a compile-time constant variable or a call to a constant constructor.
Try using a different constant value or referencing it through a constant variable.
@js
^^
main.dart:12:1:
Internal Error: Invalid @js(...) annotation.
@js
^^^
The compiler is broken.
When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Please include the following information:
- the name and version of your operating system,
Ubuntu 16.04
- the Dart SDK build number (1.15.0), and
1.15.0
- the entire message you see here (including the full stack trace
below as well as the source location above).
The compiler crashed: Internal Error: Invalid @js(...) annotation.
#0 _CompilerDiagnosticReporter.internalError (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:1963)
#1 JsInteropAnnotationHandler.validate (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/patch_parser.dart:514)
#2 EagerAnnotationHandler.checkAnnotation. (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/patch_parser.dart:431)
#3 _CompilerDiagnosticReporter.withCurrentElement (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:1753)
#4 ResolutionEnqueuer.emptyDeferredTaskQueue (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/enqueue.dart:885)
#5 ResolutionEnqueuer.onQueueEmpty (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/enqueue.dart:878)
#6 Enqueuer.forEach (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/enqueue.dart:708)
#7 Compiler.emptyQueue (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:1117)
#8 Compiler.processQueue (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:1145)
#9 Compiler.compileLoadedLibraries (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:1013)
#10 Compiler.runInternal. (file:///tmp/tmpla4aZL/dart-1.15.0/dart/pkg/compiler/lib/src/compiler.dart:884)
#11 _RootZone.runUnary (dart:async/zone.dart:1137)
#12 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:551)
#13 _Future._propagateToListeners (dart:async/future_impl.dart:637)
#14 _Future._completeWithValue (dart:async/future_impl.dart:424)
#15 _Future._asyncComplete. (dart:async/future_impl.dart:479)
#16 _microtaskLoop (dart:async/schedule_microtask.dart:41)
#17 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#18 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#19 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)