diff --git a/modules/angular2/src/core/di.ts b/modules/angular2/src/core/di.ts index 012640d722..0689a696ef 100644 --- a/modules/angular2/src/core/di.ts +++ b/modules/angular2/src/core/di.ts @@ -31,7 +31,7 @@ export { ResolvedProvider, provide } from './di/provider'; -export {Key, TypeLiteral} from './di/key'; +export {Key} from './di/key'; export { NoProviderError, AbstractProviderError, diff --git a/modules/angular2/src/core/di/key.ts b/modules/angular2/src/core/di/key.ts index 7c148b0367..dc24160533 100644 --- a/modules/angular2/src/core/di/key.ts +++ b/modules/angular2/src/core/di/key.ts @@ -1,10 +1,7 @@ import {stringify, CONST, Type, isBlank} from 'angular2/src/facade/lang'; import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {TypeLiteral} from './type_literal'; import {resolveForwardRef} from './forward_ref'; -export {TypeLiteral} from './type_literal'; - /** * A unique object used for retrieving items from the {@link Injector}. * @@ -53,13 +50,6 @@ export class KeyRegistry { get(token: Object): Key { if (token instanceof Key) return token; - // TODO: workaround for https://github.com/Microsoft/TypeScript/issues/3123 - var theToken = token; - if (token instanceof TypeLiteral) { - theToken = token.type; - } - token = theToken; - if (this._allKeys.has(token)) { return this._allKeys.get(token); } diff --git a/modules/angular2/src/core/di/type_literal.dart b/modules/angular2/src/core/di/type_literal.dart deleted file mode 100644 index b6159c1097..0000000000 --- a/modules/angular2/src/core/di/type_literal.dart +++ /dev/null @@ -1,26 +0,0 @@ -library angular2.di.type_literal; - -/** - * Use type literals as DI keys corresponding to generic types. - * - * Example: - * - * ``` - * Injector.resolveAndCreate([ - * bind(new TypeLiteral>()).toValue([1, 2, 3]) - * ]); - * - * class Foo { - * // Delend on `List` normally. - * Foo(List list) { ... } - * } - * ``` - * - * This capability might be added to the language one day. See: - * - * https://code.google.com/p/dart/issues/detail?id=11923 - */ -class TypeLiteral { - const TypeLiteral(); - Type get type => T; -} diff --git a/modules/angular2/src/core/di/type_literal.ts b/modules/angular2/src/core/di/type_literal.ts deleted file mode 100644 index 3f755c7a4f..0000000000 --- a/modules/angular2/src/core/di/type_literal.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Type literals is a Dart-only feature. This is here only so we can x-compile - * to multiple languages. - */ -export class TypeLiteral { - get type(): any { throw new Error("Type literals are only supported in Dart"); } -} diff --git a/modules/angular2/test/core/di/injector_dart_spec.dart b/modules/angular2/test/core/di/injector_dart_spec.dart deleted file mode 100644 index 5892316768..0000000000 --- a/modules/angular2/test/core/di/injector_dart_spec.dart +++ /dev/null @@ -1,22 +0,0 @@ -/// This file contains tests that make sense only in Dart -library angular2.test.di.injector_dart_spec; - -import 'package:angular2/testing_internal.dart'; -import 'package:angular2/core.dart'; - -main() { - describe('Injector', () { - it('should support TypeLiteral', () { - var i = Injector.resolveAndCreate([ - bind(new TypeLiteral>()).toValue([1, 2, 3]), - Foo, - ]); - expect(i.get(Foo).value).toEqual([1, 2, 3]); - }); - }); -} - -class Foo { - final List value; - Foo(this.value); -} diff --git a/modules/angular2/test/core/di/key_dart_spec.dart b/modules/angular2/test/core/di/key_dart_spec.dart deleted file mode 100644 index 735b84bfa3..0000000000 --- a/modules/angular2/test/core/di/key_dart_spec.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// This file contains tests that make sense only in Dart -library angular2.test.di.key_dart_spec; - -import 'package:angular2/testing_internal.dart'; -import 'package:angular2/core.dart'; -import 'package:angular2/src/core/di/key.dart'; - -main() { - describe('TypeLiteral', () { - it('contains type', () { - var t = new TypeLiteral>(); - expect('${t.type}').toEqual('List'); - }); - - it('can be a constant', () { - var a = const TypeLiteral>(); - var b = const TypeLiteral>(); - expect(identical(a, b)).toBe(true); - }); - - it('can be unique', () { - var a = const TypeLiteral>(); - var b = const TypeLiteral>(); - expect(identical(a, b)).toBe(false); - }); - }); - - describe('Key', () { - KeyRegistry registry; - - beforeEach(() { - registry = new KeyRegistry(); - }); - - it('understands TypeLiteral', () { - var k = registry.get(const TypeLiteral>()); - expect('${k.token}').toEqual('List'); - }); - }); -} diff --git a/modules/angular2/test/core/linker/integration_dart_spec.dart b/modules/angular2/test/core/linker/integration_dart_spec.dart index 3777f64d69..9a97230c56 100644 --- a/modules/angular2/test/core/linker/integration_dart_spec.dart +++ b/modules/angular2/test/core/linker/integration_dart_spec.dart @@ -42,27 +42,6 @@ void functionThatThrowsNonError() { } main() { - describe('TypeLiteral', () { - it( - 'should publish via viewBindings', - inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) { - tb - .overrideView( - Dummy, - new ViewMetadata( - template: - '', - directives: [TypeLiteralComponent])) - .createAsync(Dummy) - .then((tc) { - tc.detectChanges(); - expect(asNativeElements(tc.debugElement.children)) - .toHaveText('[Hello, World]'); - async.done(); - }); - })); - }); - describe('Error handling', () { it( 'should preserve Error stack traces thrown from components', @@ -216,19 +195,6 @@ class Dummy { dynamic value; } -@Component( - selector: 'type-literal-component', - viewBindings: const [ - const Binding(const TypeLiteral>(), - toValue: const ['Hello', 'World']) - ]) -@View(template: '{{list}}') -class TypeLiteralComponent { - final List list; - - TypeLiteralComponent(this.list); -} - @Component(selector: 'throwing-component') @View(template: '') class ThrowingComponent { diff --git a/modules/angular2/test/public_api_spec.ts b/modules/angular2/test/public_api_spec.ts index 249c2fa916..65627df495 100644 --- a/modules/angular2/test/public_api_spec.ts +++ b/modules/angular2/test/public_api_spec.ts @@ -1313,8 +1313,6 @@ var NG_CORE = [ 'GetTestability:dart', 'setTestabilityGetter()', 'Type:js', - 'TypeLiteral', - 'TypeLiteral.type', 'PACKAGE_ROOT_URL', 'View', 'View.directives', diff --git a/tools/public_api_guard/public_api_spec.ts b/tools/public_api_guard/public_api_spec.ts index d854eda9d8..c48bae6755 100644 --- a/tools/public_api_guard/public_api_spec.ts +++ b/tools/public_api_guard/public_api_spec.ts @@ -446,8 +446,6 @@ const CORE = [ 'TypeDecorator', 'TypeDecorator.Class(obj:ClassDefinition):ConcreteType', 'TypeDecorator.annotations:any[]', - 'TypeLiteral', - 'TypeLiteral.type:any', 'ViewChildFactory', 'ViewChildMetadata', 'ViewChildMetadata.constructor(_selector:Type|string)',