Skip to content

Conversation

cristaloleg
Copy link
Member

@cristaloleg cristaloleg commented Jul 27, 2023

Fixes #1354

This PR should fix the problem. Fix is somewhat hacky but at least there will be no panics.

In short: having interface as a generic field isn't supported by go/types (assert failure). Instead of copying go/types functions and fixing it it's simpler to recover from a panic and ignore this struct in a checker.

@cristaloleg cristaloleg requested a review from quasilyte July 27, 2023 09:35
@quasilyte
Copy link
Member

I asked in Gophers slack what would be the best way to handle this.
I don't like that Sizeof is so dangerous now.
If there is no good way to fix it right now, we can use kludge for now.

@quasilyte
Copy link
Member

Let's merge it for now.
I don't know if there is a much better way to do this.
It would be weird to copy the code from go/types.

I'll probably file a Go proposal that would ask a new (safe) Sizeof function.

@cristaloleg cristaloleg merged commit 40e60d7 into master Jul 27, 2023
@cristaloleg cristaloleg deleted the fix-sizeof-panic branch July 27, 2023 13:24
@korya
Copy link

korya commented Jul 27, 2023

@cristaloleg @quasilyte Thanks, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: rangeValCopy still panics on code with generics
3 participants