|
| 1 | + package pr211 |
| 2 | +// ^^^^^ definition 0.1.test `sg/pr211`/ |
| 3 | +// display_name pr211 |
| 4 | +// signature_documentation |
| 5 | +// > package pr211 |
| 6 | + |
| 7 | + // Map is a generic map type. |
| 8 | + type Map[K comparable, V any] struct { |
| 9 | +// ^^^ definition 0.1.test `sg/pr211`/Map# |
| 10 | +// signature_documentation |
| 11 | +// > type Map struct{ entries []entry[K, V] } |
| 12 | +// documentation |
| 13 | +// > Map is a generic map type. |
| 14 | +// ^ definition local 0 |
| 15 | +// display_name K |
| 16 | +// signature_documentation |
| 17 | +// > type parameter K comparable |
| 18 | +// ^ definition local 1 |
| 19 | +// display_name V |
| 20 | +// signature_documentation |
| 21 | +// > type parameter V any |
| 22 | + entries []entry[K, V] |
| 23 | +// ^^^^^^^ definition 0.1.test `sg/pr211`/Map#entries. |
| 24 | +// signature_documentation |
| 25 | +// > struct field entries []entry[K, V] |
| 26 | +// ^^^^^ reference 0.1.test `sg/pr211`/entry# |
| 27 | +// ^ reference local 0 |
| 28 | +// ^ reference local 1 |
| 29 | + } |
| 30 | + |
| 31 | + type entry[K comparable, V any] struct { |
| 32 | +// ^^^^^ definition 0.1.test `sg/pr211`/entry# |
| 33 | +// signature_documentation |
| 34 | +// > type entry struct { |
| 35 | +// > key K |
| 36 | +// > value V |
| 37 | +// > } |
| 38 | +// ^ definition local 2 |
| 39 | +// display_name K |
| 40 | +// signature_documentation |
| 41 | +// > type parameter K comparable |
| 42 | +// ^ definition local 3 |
| 43 | +// display_name V |
| 44 | +// signature_documentation |
| 45 | +// > type parameter V any |
| 46 | + key K |
| 47 | +// ^^^ definition 0.1.test `sg/pr211`/entry#key. |
| 48 | +// signature_documentation |
| 49 | +// > struct field key K |
| 50 | +// ^ reference local 2 |
| 51 | + value V |
| 52 | +// ^^^^^ definition 0.1.test `sg/pr211`/entry#value. |
| 53 | +// signature_documentation |
| 54 | +// > struct field value V |
| 55 | +// ^ reference local 3 |
| 56 | + } |
| 57 | + |
| 58 | + // Set is a generic alias that partially instantiates Map. |
| 59 | + type Set[K comparable] = Map[K, bool] |
| 60 | +// ^^^ definition 0.1.test `sg/pr211`/Set# |
| 61 | +// signature_documentation |
| 62 | +// > type Set[K comparable] = Map[K, bool] |
| 63 | +// documentation |
| 64 | +// > Set is a generic alias that partially instantiates Map. |
| 65 | +// ^ definition local 4 |
| 66 | +// display_name K |
| 67 | +// signature_documentation |
| 68 | +// > type parameter K comparable |
| 69 | +// ^^^ reference 0.1.test `sg/pr211`/Map# |
| 70 | +// ^ reference local 4 |
| 71 | + |
| 72 | + // Alias with a tighter constraint. |
| 73 | + type OrderedSet[K ~int | ~string] = Set[K] |
| 74 | +// ^^^^^^^^^^ definition 0.1.test `sg/pr211`/OrderedSet# |
| 75 | +// signature_documentation |
| 76 | +// > type OrderedSet[K ~int | ~string] = Set[K] |
| 77 | +// documentation |
| 78 | +// > Alias with a tighter constraint. |
| 79 | +// ^ definition local 5 |
| 80 | +// display_name K |
| 81 | +// signature_documentation |
| 82 | +// > type parameter K ~int | ~string |
| 83 | +// ^^^ reference 0.1.test `sg/pr211`/Set# |
| 84 | +// ^ reference local 5 |
| 85 | + |
| 86 | + // Alias of an alias (chained). |
| 87 | + type StringSet = Set[string] |
| 88 | +// ^^^^^^^^^ definition 0.1.test `sg/pr211`/StringSet# |
| 89 | +// signature_documentation |
| 90 | +// > type StringSet = Set[string] |
| 91 | +// documentation |
| 92 | +// > Alias of an alias (chained). |
| 93 | +// ^^^ reference 0.1.test `sg/pr211`/Set# |
| 94 | + |
| 95 | + // Alias with all params forwarded. |
| 96 | + type PairMap[K comparable, V any] = Map[K, V] |
| 97 | +// ^^^^^^^ definition 0.1.test `sg/pr211`/PairMap# |
| 98 | +// signature_documentation |
| 99 | +// > type PairMap[K comparable, V any] = Map[K, V] |
| 100 | +// documentation |
| 101 | +// > Alias with all params forwarded. |
| 102 | +// ^ definition local 6 |
| 103 | +// display_name K |
| 104 | +// signature_documentation |
| 105 | +// > type parameter K comparable |
| 106 | +// ^ definition local 7 |
| 107 | +// display_name V |
| 108 | +// signature_documentation |
| 109 | +// > type parameter V any |
| 110 | +// ^^^ reference 0.1.test `sg/pr211`/Map# |
| 111 | +// ^ reference local 6 |
| 112 | +// ^ reference local 7 |
| 113 | + |
| 114 | +//⌄ enclosing_range_start 0.1.test `sg/pr211`/UseAliases(). |
| 115 | + func UseAliases() { |
| 116 | +// ^^^^^^^^^^ definition 0.1.test `sg/pr211`/UseAliases(). |
| 117 | +// signature_documentation |
| 118 | +// > func UseAliases() |
| 119 | + _ = Set[int]{} |
| 120 | +// ^^^ reference 0.1.test `sg/pr211`/Set# |
| 121 | + _ = OrderedSet[int]{} |
| 122 | +// ^^^^^^^^^^ reference 0.1.test `sg/pr211`/OrderedSet# |
| 123 | + _ = StringSet{} |
| 124 | +// ^^^^^^^^^ reference 0.1.test `sg/pr211`/StringSet# |
| 125 | + _ = PairMap[string, int]{} |
| 126 | +// ^^^^^^^ reference 0.1.test `sg/pr211`/PairMap# |
| 127 | + } |
| 128 | +//⌃ enclosing_range_end 0.1.test `sg/pr211`/UseAliases(). |
| 129 | + |
0 commit comments