File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,13 @@ namespace A {
574
574
[#|t1.toString();
575
575
t2.toString();|]
576
576
}
577
+ }` ) ;
578
+ // Confirm that the constraint is preserved.
579
+ testExtractMethod ( "extractMethod15" ,
580
+ `function F<T>(t1: T) {
581
+ function F<U extends T[]>(t2: U) {
582
+ [#|t2.toString();|]
583
+ }
577
584
}` ) ;
578
585
} ) ;
579
586
@@ -590,7 +597,7 @@ namespace A {
590
597
path : "/a.ts" ,
591
598
content : t . source
592
599
} ;
593
- const host = projectSystem . createServerHost ( [ f ] ) ;
600
+ const host = projectSystem . createServerHost ( [ f , projectSystem . libFile ] ) ;
594
601
const projectService = projectSystem . createProjectService ( host ) ;
595
602
projectService . openClientFile ( f . path ) ;
596
603
const program = projectService . inferredProjects [ 0 ] . getLanguageService ( ) . getProgram ( ) ;
Original file line number Diff line number Diff line change
1
+ // ==ORIGINAL==
2
+ function F < T > ( t1 : T ) {
3
+ function F < U extends T [ ] > ( t2 : U ) {
4
+ t2 . toString ( ) ;
5
+ }
6
+ }
7
+ // ==SCOPE::function 'F'==
8
+ function F < T > ( t1 : T ) {
9
+ function F < U extends T [ ] > ( t2 : U ) {
10
+ newFunction ( ) ;
11
+
12
+ function newFunction ( ) {
13
+ t2 . toString ( ) ;
14
+ }
15
+ }
16
+ }
17
+ // ==SCOPE::function 'F'==
18
+ function F < T > ( t1 : T ) {
19
+ function F < U extends T [ ] > ( t2 : U ) {
20
+ newFunction < U > ( t2 ) ;
21
+ }
22
+
23
+ function newFunction < U extends T [ ] > ( t2 : U ) {
24
+ t2 . toString ( ) ;
25
+ }
26
+ }
27
+ // ==SCOPE::global scope==
28
+ function F < T > ( t1 : T ) {
29
+ function F < U extends T [ ] > ( t2 : U ) {
30
+ newFunction < T , U > ( t2 ) ;
31
+ }
32
+ }
33
+ function newFunction < T , U extends T [ ] > ( t2 : U ) {
34
+ t2 . toString ( ) ;
35
+ }
You can’t perform that action at this time.
0 commit comments