Skip to content

Commit 76795ef

Browse files
committed
gopls/doc: audit for types.Alias safety
Updates golang/go#65294 Change-Id: Ie4a873d5953e495924fc5b6691dc8e43b6917bb0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/562037 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Alan Donovan <[email protected]>
1 parent ab67961 commit 76795ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gopls/doc/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func loadOptions(category reflect.Value, optsType types.Object, pkg *packages.Pa
242242
name := lowerFirst(typesField.Name())
243243

244244
var enumKeys settings.EnumKeys
245-
if m, ok := typesField.Type().(*types.Map); ok {
245+
if m, ok := typesField.Type().Underlying().(*types.Map); ok {
246246
e, ok := enums[m.Key()]
247247
if ok {
248248
typ = strings.Replace(typ, m.Key().String(), m.Key().Underlying().String(), 1)
@@ -313,7 +313,7 @@ func collectEnumKeys(name string, m *types.Map, reflectField reflect.Value, enum
313313
}
314314
// We can get default values for enum -> bool maps.
315315
var isEnumBoolMap bool
316-
if basic, ok := m.Elem().(*types.Basic); ok && basic.Kind() == types.Bool {
316+
if basic, ok := m.Elem().Underlying().(*types.Basic); ok && basic.Kind() == types.Bool {
317317
isEnumBoolMap = true
318318
}
319319
for _, v := range enumValues {

0 commit comments

Comments
 (0)