"type declarations inside generic functions are not currently supported"
This commit is contained in:
Owen Mansel-Chan 2022-04-27 15:47:53 +01:00 коммит произвёл Chris Smowton
Родитель aa62fabe26
Коммит 7f1f428b41
4 изменённых файлов: 10 добавлений и 30 удалений

Просмотреть файл

@ -1,6 +1,3 @@
| A | comparable |
| B1 | interface { } |
| B2 | interface { } |
| Edge | EdgeConstraint |
| Edge | interface { } |
| K | comparable |

Просмотреть файл

@ -119,19 +119,6 @@ func (l *List[U]) MyLen() int {
return 0
}
func outerFunction[A comparable](x1 A) {
type innerStruct[B1 any] struct {
x1 A
x2 B1
}
type innerMap[B2 any] map[A]B2
var x innerStruct[string]
_ = x
var y innerMap[bool]
_ = y
}
type NodeConstraint[Edge any] interface {
Edges() []Edge
}

Просмотреть файл

@ -5,11 +5,10 @@
| genericFunctions.go:93:35:93:36 | f2 | -1 | genericFunctions.go:93:7:93:7 | x |
| genericFunctions.go:96:36:96:37 | g2 | -1 | genericFunctions.go:96:7:96:7 | x |
| genericFunctions.go:118:19:118:23 | MyLen | -1 | genericFunctions.go:118:7:118:7 | l |
| genericFunctions.go:122:6:122:18 | outerFunction | 0 | genericFunctions.go:122:34:122:35 | x1 |
| genericFunctions.go:145:6:145:8 | New | 0 | genericFunctions.go:145:64:145:68 | nodes |
| genericFunctions.go:149:29:149:40 | ShortestPath | 0 | genericFunctions.go:149:42:149:45 | from |
| genericFunctions.go:149:29:149:40 | ShortestPath | 1 | genericFunctions.go:149:48:149:49 | to |
| genericFunctions.go:149:29:149:40 | ShortestPath | -1 | genericFunctions.go:149:7:149:7 | g |
| genericFunctions.go:132:6:132:8 | New | 0 | genericFunctions.go:132:64:132:68 | nodes |
| genericFunctions.go:136:29:136:40 | ShortestPath | 0 | genericFunctions.go:136:42:136:45 | from |
| genericFunctions.go:136:29:136:40 | ShortestPath | 1 | genericFunctions.go:136:48:136:49 | to |
| genericFunctions.go:136:29:136:40 | ShortestPath | -1 | genericFunctions.go:136:7:136:7 | g |
| main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x |
| main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x |
| main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y |

Просмотреть файл

@ -6,12 +6,9 @@
| genericFunctions.go:82:6:83:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:82:21:82:28 | type parameter declaration | 1 | genericFunctions.go:82:24:82:24 | T | genericFunctions.go:82:26:82:28 | any | interface { } |
| genericFunctions.go:109:6:111:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:109:14:109:18 | type parameter declaration | 0 | genericFunctions.go:109:14:109:14 | S | genericFunctions.go:109:16:109:18 | any | interface { } |
| genericFunctions.go:113:6:115:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:113:11:113:15 | type parameter declaration | 0 | genericFunctions.go:113:11:113:11 | T | genericFunctions.go:113:13:113:15 | any | interface { } |
| genericFunctions.go:122:1:133:1 | function declaration | FuncDecl | 0 | genericFunctions.go:122:20:122:31 | type parameter declaration | 0 | genericFunctions.go:122:20:122:20 | A | genericFunctions.go:122:22:122:31 | comparable | comparable |
| genericFunctions.go:123:7:126:2 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:123:19:123:24 | type parameter declaration | 0 | genericFunctions.go:123:19:123:20 | B1 | genericFunctions.go:123:22:123:24 | any | interface { } |
| genericFunctions.go:127:7:127:31 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:127:16:127:21 | type parameter declaration | 0 | genericFunctions.go:127:16:127:17 | B2 | genericFunctions.go:127:19:127:21 | any | interface { } |
| genericFunctions.go:135:6:137:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:135:21:135:28 | type parameter declaration | 0 | genericFunctions.go:135:21:135:24 | Edge | genericFunctions.go:135:26:135:28 | any | interface { } |
| genericFunctions.go:139:6:141:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:139:21:139:28 | type parameter declaration | 0 | genericFunctions.go:139:21:139:24 | Node | genericFunctions.go:139:26:139:28 | any | interface { } |
| genericFunctions.go:143:6:143:73 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:143:12:143:36 | type parameter declaration | 0 | genericFunctions.go:143:12:143:15 | Node | genericFunctions.go:143:17:143:36 | generic type instantiation expression | NodeConstraint |
| genericFunctions.go:143:6:143:73 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:143:39:143:63 | type parameter declaration | 0 | genericFunctions.go:143:39:143:42 | Edge | genericFunctions.go:143:44:143:63 | generic type instantiation expression | EdgeConstraint |
| genericFunctions.go:145:1:147:1 | function declaration | FuncDecl | 0 | genericFunctions.go:145:10:145:34 | type parameter declaration | 0 | genericFunctions.go:145:10:145:13 | Node | genericFunctions.go:145:15:145:34 | generic type instantiation expression | NodeConstraint |
| genericFunctions.go:145:1:147:1 | function declaration | FuncDecl | 1 | genericFunctions.go:145:37:145:61 | type parameter declaration | 0 | genericFunctions.go:145:37:145:40 | Edge | genericFunctions.go:145:42:145:61 | generic type instantiation expression | EdgeConstraint |
| genericFunctions.go:122:6:124:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:122:21:122:28 | type parameter declaration | 0 | genericFunctions.go:122:21:122:24 | Edge | genericFunctions.go:122:26:122:28 | any | interface { } |
| genericFunctions.go:126:6:128:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:126:21:126:28 | type parameter declaration | 0 | genericFunctions.go:126:21:126:24 | Node | genericFunctions.go:126:26:126:28 | any | interface { } |
| genericFunctions.go:130:6:130:73 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:130:12:130:36 | type parameter declaration | 0 | genericFunctions.go:130:12:130:15 | Node | genericFunctions.go:130:17:130:36 | generic type instantiation expression | NodeConstraint |
| genericFunctions.go:130:6:130:73 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:130:39:130:63 | type parameter declaration | 0 | genericFunctions.go:130:39:130:42 | Edge | genericFunctions.go:130:44:130:63 | generic type instantiation expression | EdgeConstraint |
| genericFunctions.go:132:1:134:1 | function declaration | FuncDecl | 0 | genericFunctions.go:132:10:132:34 | type parameter declaration | 0 | genericFunctions.go:132:10:132:13 | Node | genericFunctions.go:132:15:132:34 | generic type instantiation expression | NodeConstraint |
| genericFunctions.go:132:1:134:1 | function declaration | FuncDecl | 1 | genericFunctions.go:132:37:132:61 | type parameter declaration | 0 | genericFunctions.go:132:37:132:40 | Edge | genericFunctions.go:132:42:132:61 | generic type instantiation expression | EdgeConstraint |