Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-21.0] sizegen: do not ignore type aliases (#17556) #17557

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions go/mysql/collations/colldata/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions go/sqltypes/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions go/tools/sizegen/sizegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ func (sizegen *sizegen) generateTyp(tt types.Type) {
sizegen.generateKnownType(tt)
case *types.Alias:
sizegen.generateTyp(types.Unalias(tt))
default:
panic(fmt.Sprintf("unhandled type: %v (%T)", tt, tt))
}
}

Expand Down Expand Up @@ -490,9 +492,11 @@ func (sizegen *sizegen) sizeStmtForType(fieldName *jen.Statement, field types.Ty
// assume that function pointers do not allocate (although they might, if they're closures)
return nil, 0

case *types.Alias:
return sizegen.sizeStmtForType(fieldName, types.Unalias(node), alloc)

default:
log.Printf("unhandled type: %T", node)
return nil, 0
panic(fmt.Sprintf("unhandled type: %v (%T)", node, node))
}
}

Expand Down
20 changes: 20 additions & 0 deletions go/vt/proto/query/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions go/vt/proto/topodata/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions go/vt/proto/vttime/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading