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

Side by Side Diff: tests/compiler/dart2js/unparser_test.dart

Issue 10861029: Properly rename type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:uri'); 5 #import('dart:uri');
6 #import('parser_helper.dart'); 6 #import('parser_helper.dart');
7 #import('mock_compiler.dart'); 7 #import('mock_compiler.dart');
8 #import("../../../lib/compiler/compiler.dart"); 8 #import("../../../lib/compiler/compiler.dart");
9 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); 9 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart");
10 #import("../../../lib/compiler/implementation/elements/elements.dart"); 10 #import("../../../lib/compiler/implementation/elements/elements.dart");
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 'class A implements I{A(){}}' 506 'class A implements I{A(){}}'
507 'class B{factory I(){}}' 507 'class B{factory I(){}}'
508 'interface p_I default p_B{p_I();}' 508 'interface p_I default p_B{p_I();}'
509 'class p_A implements p_I{p_A(){}}' 509 'class p_A implements p_I{p_A(){}}'
510 'class p_B{factory p_I(){}}' 510 'class p_B{factory p_I(){}}'
511 'main(){new p_I(); new p_A(); new I(); new A();}'; 511 'main(){new p_I(); new p_A(); new I(); new A();}';
512 testDart2DartWithLibrary(mainSrc, librarySrc, 512 testDart2DartWithLibrary(mainSrc, librarySrc,
513 (String result) { Expect.equals(expectedResult, result); }); 513 (String result) { Expect.equals(expectedResult, result); });
514 } 514 }
515 515
516 testTypeVariablesAreRenamed() {
517 // Somewhat a hack: we require all the references of the identifier
518 // to be renamed in the same way for the whole library. Hence
519 // if we have a class and type variable with the same name, they
520 // both should be renamed.
521 var librarySrc = '''
522 #library('mylib');
523 class T {}
524 class B<T> {}
525 class A<T> extends B<T> { T f; }
526 ''';
527 var mainSrc = '''
528 #import('mylib.dart', prefix: 'mylib');
529 class T {}
530 class B<T> {}
531 class A<T> extends B<T> { T f; }
532
533 main() {
534 new A<int>().f;
535 new T();
536
537 new mylib.A<int>().f;
538 new mylib.T();
539 }
540 ''';
541 var expectedResult =
542 'class T{}class B<T>{}class A<T> extends B<T>{T f;}'
543 'class p_T{}class p_B<p_T>{}class p_A<p_T> extends p_B<p_T>{p_T f;}'
544 'main(){new p_A<int>().f; new p_T(); new A<int>().f; new T();}';
545 testDart2DartWithLibrary(mainSrc, librarySrc,
546 (String result) { Expect.equals(expectedResult, result); });
547 }
548
516 main() { 549 main() {
517 testSignedConstants(); 550 testSignedConstants();
518 testGenericTypes(); 551 testGenericTypes();
519 testForLoop(); 552 testForLoop();
520 testEmptyList(); 553 testEmptyList();
521 testClosure(); 554 testClosure();
522 testIndexedOperatorDecl(); 555 testIndexedOperatorDecl();
523 testNativeMethods(); 556 testNativeMethods();
524 testPrefixIncrements(); 557 testPrefixIncrements();
525 testConstModifier(); 558 testConstModifier();
(...skipping 11 matching lines...) Expand all
537 //testConflictSendsRename(); 570 //testConflictSendsRename();
538 testNoConflictSendsRename(); 571 testNoConflictSendsRename();
539 testConflictLibraryClassRename(); 572 testConflictLibraryClassRename();
540 testDefaultClassWithArgs(); 573 testDefaultClassWithArgs();
541 testClassExtendsWithArgs(); 574 testClassExtendsWithArgs();
542 testStaticInvocation(); 575 testStaticInvocation();
543 testLibraryGetSet(); 576 testLibraryGetSet();
544 testFieldTypeOutput(); 577 testFieldTypeOutput();
545 testDefaultClassNamePlaceholder(); 578 testDefaultClassNamePlaceholder();
546 testFactoryRename(); 579 testFactoryRename();
580 testTypeVariablesAreRenamed();
547 } 581 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698