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

Inconsistency in type of vararg parameter of overriden method #958

Closed
efemoney opened this issue Apr 14, 2022 · 1 comment · Fixed by #993
Closed

Inconsistency in type of vararg parameter of overriden method #958

efemoney opened this issue Apr 14, 2022 · 1 comment · Fixed by #993
Assignees
Labels
bug Something isn't working
Milestone

Comments

@efemoney
Copy link

Say I have these 2 classes:

@ProcessThis
interface Sub : Super

@ProcessThis
interface Super {
  fun foo(vararg values: String)
}

When processing any of the KSClassDeclarations with getAllFunctions().filter { it.isAbstract }.forEach { ... }, the values parameter for Super has

  KSValueParameter.isVararg == true
  KSValueParameter.type.resolve() == 'String'

but Sub has

  KSValueParameter.isVararg == true
  KSValueParameter.type.resolve() == 'Array<String>'

which is very inconsistent.

They should either both be, vararg=true type=String or both be vararg=true type=Array<String>

@neetopia neetopia self-assigned this May 3, 2022
@neetopia neetopia added the bug Something isn't working label May 3, 2022
@neetopia neetopia added this to the 1.0.6 milestone May 3, 2022
@bitPogo
Copy link

bitPogo commented May 11, 2022

Hey - as mentioned on KotlinSlack - I run in the same issue and in order not to spam your backlog, I'd like to share my finding here. So please consider the example above:
The value of KSValueParameter.type.element.typeArguments the values differs. While Super will have no TypeArguments present, Sub will have at least one - which can be resolved to a covariant type (so in this case out String).
Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants