|
| 1 | +=== tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts === |
| 2 | +// Repro from #31204 |
| 3 | + |
| 4 | +export enum AppType { |
| 5 | +>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0)) |
| 6 | + |
| 7 | + HeaderDetail = 'HeaderDetail', |
| 8 | +>HeaderDetail : Symbol(AppType.HeaderDetail, Decl(arrayLiteralInference.ts, 2, 21)) |
| 9 | + |
| 10 | + HeaderMultiDetail = 'HeaderMultiDetail', |
| 11 | +>HeaderMultiDetail : Symbol(AppType.HeaderMultiDetail, Decl(arrayLiteralInference.ts, 3, 34)) |
| 12 | + |
| 13 | + AdvancedList = 'AdvancedList', |
| 14 | +>AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44)) |
| 15 | + |
| 16 | + Standard = 'Standard', |
| 17 | +>Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34)) |
| 18 | + |
| 19 | + Relationship = 'Relationship', |
| 20 | +>Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26)) |
| 21 | + |
| 22 | + Report = 'Report', |
| 23 | +>Report : Symbol(AppType.Report, Decl(arrayLiteralInference.ts, 7, 34)) |
| 24 | + |
| 25 | + Composite = 'Composite', |
| 26 | +>Composite : Symbol(AppType.Composite, Decl(arrayLiteralInference.ts, 8, 22)) |
| 27 | + |
| 28 | + ListOnly = 'ListOnly', |
| 29 | +>ListOnly : Symbol(AppType.ListOnly, Decl(arrayLiteralInference.ts, 9, 28)) |
| 30 | + |
| 31 | + ModuleSettings = 'ModuleSettings' |
| 32 | +>ModuleSettings : Symbol(AppType.ModuleSettings, Decl(arrayLiteralInference.ts, 10, 26)) |
| 33 | +} |
| 34 | + |
| 35 | +export enum AppStyle { |
| 36 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 37 | + |
| 38 | + Tree, |
| 39 | +>Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22)) |
| 40 | + |
| 41 | + TreeEntity, |
| 42 | +>TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9)) |
| 43 | + |
| 44 | + Standard, |
| 45 | +>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 46 | + |
| 47 | + MiniApp, |
| 48 | +>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13)) |
| 49 | + |
| 50 | + PivotTable |
| 51 | +>PivotTable : Symbol(AppStyle.PivotTable, Decl(arrayLiteralInference.ts, 18, 12)) |
| 52 | +} |
| 53 | + |
| 54 | +const appTypeStylesWithError: Map<AppType, Array<AppStyle>> = new Map([ |
| 55 | +>appTypeStylesWithError : Symbol(appTypeStylesWithError, Decl(arrayLiteralInference.ts, 22, 5)) |
| 56 | +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 57 | +>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0)) |
| 58 | +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 59 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 60 | +>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 61 | + |
| 62 | + [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], |
| 63 | +>AppType.Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34)) |
| 64 | +>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0)) |
| 65 | +>Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34)) |
| 66 | +>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 67 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 68 | +>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 69 | +>AppStyle.MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13)) |
| 70 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 71 | +>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13)) |
| 72 | + |
| 73 | + [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], |
| 74 | +>AppType.Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26)) |
| 75 | +>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0)) |
| 76 | +>Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26)) |
| 77 | +>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 78 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 79 | +>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 80 | +>AppStyle.Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22)) |
| 81 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 82 | +>Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22)) |
| 83 | +>AppStyle.TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9)) |
| 84 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 85 | +>TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9)) |
| 86 | + |
| 87 | + [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]] |
| 88 | +>AppType.AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44)) |
| 89 | +>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0)) |
| 90 | +>AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44)) |
| 91 | +>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 92 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 93 | +>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15)) |
| 94 | +>AppStyle.MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13)) |
| 95 | +>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1)) |
| 96 | +>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13)) |
| 97 | + |
| 98 | +]); |
| 99 | + |
| 100 | +// Repro from #31204 |
| 101 | + |
| 102 | +declare function foo<T>(...args: T[]): T[]; |
| 103 | +>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3)) |
| 104 | +>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21)) |
| 105 | +>args : Symbol(args, Decl(arrayLiteralInference.ts, 30, 24)) |
| 106 | +>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21)) |
| 107 | +>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21)) |
| 108 | + |
| 109 | +let b1: { x: boolean }[] = foo({ x: true }, { x: false }); |
| 110 | +>b1 : Symbol(b1, Decl(arrayLiteralInference.ts, 31, 3)) |
| 111 | +>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 9)) |
| 112 | +>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3)) |
| 113 | +>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 32)) |
| 114 | +>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 45)) |
| 115 | + |
| 116 | +let b2: boolean[][] = foo([true], [false]); |
| 117 | +>b2 : Symbol(b2, Decl(arrayLiteralInference.ts, 32, 3)) |
| 118 | +>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3)) |
| 119 | + |
0 commit comments