Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: test/codegen/language/type_literal_test.dart

Issue 1944483002: Redo how Type objects are exposed from DDC. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: More tweaks. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen/expect/misc.js ('k') | tool/input_sdk/lib/js/dart2js/js_dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 // TODO(rnystrom): This test has a lot of overlap with some other language
8 // tests, but those are sort of all over the place so I thought it useful to
9 // test all of the relevant bits in one place here.
10
11 class Foo {}
12
13 class Box<T> {
14 Type get typeArg => T;
15 }
16
17 typedef int Func(bool b);
18 typedef int GenericFunc<T>(T t);
19
20 main() {
21 // Primitive types.
22 testType(Object, "Object");
23 testType(Null, "Null");
24 testType(bool, "bool");
25 testType(double, "double");
26 testType(int, "int");
27 testType(num, "num");
28 testType(String, "String");
29
30 // Class types.
31 testType(Foo, "Foo");
32
33 // Generic classes.
34 testType(Box, "Box");
35 testType(new Box<Foo>().typeArg, "Foo");
36 testType(new Box<dynamic>().typeArg, "dynamic");
37 testType(new Box<Box<Foo>>().typeArg, "Box<Foo>");
38
39 // Typedef.
40 testType(Func, "Func");
41 testType(GenericFunc, "GenericFunc");
42
43 // TODO(rnystrom): This should print "GenericFunc<int>", but that isn't
44 // implemented yet.
45 testType(new Box<GenericFunc<int>>().typeArg, "GenericFunc");
46
47 // Literals are canonicalized.
48 Expect.identical(Foo, Foo);
49 Expect.identical(Box, Box);
50 Expect.identical(new Box<Foo>().typeArg, new Box<Foo>().typeArg);
51 Expect.identical(Func, Func);
52 }
OLDNEW
« no previous file with comments | « test/codegen/expect/misc.js ('k') | tool/input_sdk/lib/js/dart2js/js_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698