@@ -247,6 +247,15 @@ var Issue56048 = Issue56048_I.m
247
247
type Issue56048_Ib interface{ m() chan []*interface { Issue56048_Ib } }
248
248
var Issue56048b = Issue56048_Ib.m
249
249
250
+ // Non-generic alias
251
+ type NonAlias int
252
+ type Alias1 = NonAlias
253
+ type Alias2 = NonAlias
254
+
255
+ // Generic alias (requires go1.23)
256
+ // type SetOfInt = map[int]bool
257
+ // type Set[T comparable] = map[K]bool
258
+ // type SetOfInt2 = Set[int]
250
259
`
251
260
252
261
fset := token .NewFileSet ()
@@ -307,6 +316,16 @@ var Issue56048b = Issue56048_Ib.m
307
316
Quux = scope .Lookup ("Quux" ).Type ()
308
317
Issue56048 = scope .Lookup ("Issue56048" ).Type ()
309
318
Issue56048b = scope .Lookup ("Issue56048b" ).Type ()
319
+
320
+ // In go1.23 these will be *types.Alias; for now they are all int.
321
+ NonAlias = scope .Lookup ("NonAlias" ).Type ()
322
+ Alias1 = scope .Lookup ("Alias1" ).Type ()
323
+ Alias2 = scope .Lookup ("Alias2" ).Type ()
324
+
325
+ // Requires go1.23.
326
+ // SetOfInt = scope.Lookup("SetOfInt").Type()
327
+ // Set = scope.Lookup("Set").Type().(*types.Alias)
328
+ // SetOfInt2 = scope.Lookup("SetOfInt2").Type()
310
329
)
311
330
312
331
tmap := new (typeutil.Map )
@@ -379,6 +398,16 @@ var Issue56048b = Issue56048_Ib.m
379
398
380
399
{Issue56048 , "Issue56048" , true }, // (not actually about generics)
381
400
{Issue56048b , "Issue56048b" , true }, // (not actually about generics)
401
+
402
+ // All three types are identical.
403
+ {NonAlias , "NonAlias" , true },
404
+ {Alias1 , "Alias1" , false },
405
+ {Alias2 , "Alias2" , false },
406
+
407
+ // Generic aliases: requires go1.23.
408
+ // {SetOfInt, "SetOfInt", true},
409
+ // {Set, "Set", false},
410
+ // {SetOfInt2, "SetOfInt2", false},
382
411
}
383
412
384
413
for _ , step := range steps {
0 commit comments