Skip to content

Commit 57cec2f

Browse files
[dev.go2go] go/go2go: accept slash in an instantiated type name
It shows up when instantiating with types with a package path containing a slash, as in net/url.Error. Fixes #39642 Change-Id: Icf40e7bcdf1de7c84f58ebde35ebffadbb071d72 Reviewed-on: https://go-review.googlesource.com/c/go/+/238623 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent e531e11 commit 57cec2f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/go/go2go/names.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ var nameCodes = map[rune]int{
3333
'.': 10,
3434
'<': 11,
3535
'-': 12,
36-
nameSep: 13,
37-
nameIntro: 14,
36+
'/': 13,
37+
nameSep: 14,
38+
nameIntro: 15,
3839
}
3940

4041
// instantiatedName returns the name of a newly instantiated function.

test/gen/g023.go2

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// compile
2+
3+
// Copyright 2020 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package p
8+
9+
import "net/url"
10+
11+
type S(type T) struct {
12+
f T
13+
}
14+
15+
func F() S(url.Error) {
16+
return S(url.Error){}
17+
}

0 commit comments

Comments
 (0)