OLD | NEW |
1 abstract class FooBase<Tf> { | 1 abstract class FooBase<Tf> { |
2 » int get x; | 2 int get x; |
3 » factory FooBase(int x) = Foo<Tf>; | 3 factory FooBase(int x) = Foo<Tf>; |
4 } | 4 } |
5 | 5 |
6 abstract class Foo<T> implements FooBase { | 6 abstract class Foo<T> implements FooBase { |
7 » factory Foo(int x) = Bar<String,T>; | 7 factory Foo(int x) = Bar<String, T>; |
8 } | 8 } |
9 | 9 |
10 class Bar<Sb,Tb> implements Foo<Tb> { | 10 class Bar<Sb, Tb> implements Foo<Tb> { |
11 » int x; | 11 int x; |
12 » Bar(this.x) { | 12 Bar(this.x) { |
13 » » print('Bar<$Sb,$Tb>'); | 13 print('Bar<$Sb,$Tb>'); |
14 » } | 14 } |
15 } | 15 } |
16 | 16 |
17 class Builder<X> { | 17 class Builder<X> { |
18 » method() { | 18 method() { |
19 » » return new FooBase<X>(4); | 19 return new FooBase<X>(4); |
20 » } | 20 } |
21 } | 21 } |
22 | 22 |
23 class SimpleCase<A,B> { | 23 class SimpleCase<A, B> { |
24 » factory SimpleCase() = SimpleCaseImpl<A,B>; | 24 factory SimpleCase() = SimpleCaseImpl<A, B>; |
25 } | 25 } |
26 | 26 |
27 class SimpleCaseImpl<Ai,Bi> implements SimpleCase<Ai,Bi> { | 27 class SimpleCaseImpl<Ai, Bi> implements SimpleCase<Ai, Bi> { |
28 » factory SimpleCaseImpl() = SimpleCaseImpl2<Ai,Bi>; | 28 factory SimpleCaseImpl() = SimpleCaseImpl2<Ai, Bi>; |
29 } | 29 } |
30 | 30 |
31 class SimpleCaseImpl2<Ai2,Bi2> implements SimpleCaseImpl<Ai2,Bi2> { | 31 class SimpleCaseImpl2<Ai2, Bi2> implements SimpleCaseImpl<Ai2, Bi2> {} |
32 } | |
33 | 32 |
34 class Base<M> { | 33 class Base<M> {} |
35 | 34 |
36 } | 35 class Mixin<M> {} |
37 class Mixin<M> { | |
38 | |
39 } | |
40 | 36 |
41 class Mix<M> = Base<M> with Mixin<M>; | 37 class Mix<M> = Base<M> with Mixin<M>; |
42 | 38 |
43 main() { | 39 main() { |
44 » print(new FooBase<double>(4).x); | 40 print(new FooBase<double>(4).x); |
45 » new SimpleCase<int,double>(); | 41 new SimpleCase<int, double>(); |
46 » new Mix<double>(); | 42 new Mix<double>(); |
47 } | 43 } |
OLD | NEW |