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

Constructors returnType is null #114

Closed
IVIanuu opened this issue Oct 6, 2020 · 2 comments
Closed

Constructors returnType is null #114

IVIanuu opened this issue Oct 6, 2020 · 2 comments
Assignees
Labels
bug Something isn't working P2 affects usability but not blocks users
Milestone

Comments

@IVIanuu
Copy link

IVIanuu commented Oct 6, 2020

I think the returnType of a constructor should be the constructed class and not null.

@ting-yuan ting-yuan added bug Something isn't working P1 major features or blocking bugs labels Oct 9, 2020
@ting-yuan ting-yuan added this to the 2020Q4 milestone Oct 9, 2020
@ting-yuan
Copy link
Collaborator

KSConstructorSyntheticImpl.returnType is always null. Maybe simply return a reference to the default type or star projection.

@ting-yuan ting-yuan added P2 affects usability but not blocks users and removed P1 major features or blocking bugs labels Oct 9, 2020
@IVIanuu
Copy link
Author

IVIanuu commented Oct 13, 2020

Returning the defaultType would fix my issue. This is also what the Descriptors's and IrElement's do.

@ting-yuan ting-yuan modified the milestones: 2020Q4, 2021Q1 Dec 31, 2020
yigit added a commit to yigit/ksp that referenced this issue Jan 28, 2021
This PR fixes a bunch of issues / inconsistencies in constuctor
delcarations.

* changed KSFunctionDeclarationImpl and KSFunctionDeclarationJavaImpl
to return <init> from name if it is constructor for consistency
* added KSFunctionDeclaration.isConstructor extension function for
convenience
* changed getConstructors to simply use
declaredFunctions.filter { it.kind == CONSTURCTOR } for consistency
* updated KSClassDeclarationDescriptorImpl.kt declarations to include
* added synthetic constructors for non-interface classes that do not
have a constructor (including java annotations which do get a
constructor when they are in .class files)
* fixed KSConstructorSyntheticImpl to implement returnType

Fixes: google#273
Fixes: google#114
Fixes: google#113
Test: constructorDeclarations.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 affects usability but not blocks users
Projects
None yet
Development

No branches or pull requests

3 participants