Skip to content

Instantly share code, notes, and snippets.

@kevmoo
Last active December 19, 2015 22:58
Show Gist options
  • Save kevmoo/6030995 to your computer and use it in GitHub Desktop.
Save kevmoo/6030995 to your computer and use it in GitHub Desktop.
Dart Bug: mixins with aliased imports Repo for https://code.google.com/p/dart/issues/detail?id=11891
library mixin_library;
import 'dart:json' as json;
class MixinClass {
String bar() => json.stringify({'a':1});
}
import 'mixin_class.dart';
// Runtime error without this import
// import 'dart:json' as json;
class Oops extends Object with MixinClass {
String baz() => bar();
}
void main() {
print("Hello, World!");
var oops = new Oops();
print(oops.baz());
}
@kevmoo
Copy link
Author

kevmoo commented Jul 18, 2013

dart --checked bin/mixin_library_fun.dart
Hello, World!
Unhandled exception:
Class 'Oops' has no instance getter 'json'.

NoSuchMethodError : method not found: 'json'
Receiver: Instance of 'Oops'
Arguments: []
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:23:25)
#1 BaseClass&MixinClass.bar (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_class.dart:7:19)
#2 Oops.baz (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_library_fun.dart:9:36)
#3 main (file:///Users/kevin/Desktop/mixin_library_fun/bin/mixin_library_fun.dart:18:17)

@kevmoo
Copy link
Author

kevmoo commented Jul 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment