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

[KSP] Multiple @Inject + @AssistedInject constructors error message regression #3991

Closed
ZacSweers opened this issue Aug 3, 2023 · 2 comments

Comments

@ZacSweers
Copy link

ZacSweers commented Aug 3, 2023

Given this code snippet

class AssistedService @AssistedInject constructor(
  int: Int,
  @Assisted string: String
) {
  @Inject constructor(@Assisted string: String)
}

In apt, the error message reads like so

Type com.squareup.test.AssistedService may only contain one injected constructor. Found: [@Inject com.squareup.test.AssistedService, @dagger.assisted.AssistedInject com.squareup.test.AssistedService]

In KSP however, it yields a less meaningful message

e: [ksp] /var/folders/nv/96k28mh96ml0g6y4gxkpjfcw0000gn/T/Kotlin-Compilation383082458378581560/sources/src/main/java/com/squareup/test/Source0.kt:11: @Assisted parameters can only be used within an @AssistedInject-annotated constructor.

This is with Dagger version 2.47.

@ZacSweers ZacSweers changed the title [KSP] Multiple @Inject + @AssistedInject constructors error message regression [KSP] Multiple @Inject/@AssistedInject constructors error message regression Aug 3, 2023
@ZacSweers ZacSweers changed the title [KSP] Multiple @Inject/@AssistedInject constructors error message regression [KSP] Multiple @Inject + @AssistedInject constructors error message regression Aug 3, 2023
@ZacSweers

This comment was marked as outdated.

@bcorso
Copy link

bcorso commented Aug 22, 2023

This was fixed by 698f6cb.

The fix will be included in the next release.

@bcorso bcorso closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants