-
Notifications
You must be signed in to change notification settings - Fork 10
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
analyze_types: better support for type aliases #23
Comments
The problem is that in many cases, we get the underlying type from static code analysis: forbidigo/forbidigo/forbidigo.go Lines 273 to 285 in 1396000
I'm not sure whether it is possible to detect that the type was reached through an alias. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The recently merged semantic analysis has one drawback when dealing with type aliases: they always get replaced with the underlying type. Example:
A pattern
somepkg.SomeType.ForbiddenMethod
does not match becauseSomeType
is an alias. What works isanotherpkg.AnotherType.ForbiddenMethod
.This is a) unexpected and b) can cause a pattern that works with a version of a package where the type is not an alias to stop working when the packages switches to a type alias.
It would be better if forbidigo matched against both the underlying type (
anotherpkg.AnotherType
) and the alias (somepkg.SomeType
).The text was updated successfully, but these errors were encountered: