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

["BUG"][Arrow Optics] Unresolved reference when a property have same name with package name #2909

Closed
risalfajar opened this issue Jan 27, 2023 · 2 comments

Comments

@risalfajar
Copy link

What version are you currently using?
1.1.5

I have this class (notice id parameter and the package name):

package id.co.appname.features.main.transaction.data

import arrow.optics.optics

@optics
data class TransactedItem(
    val id: String = "", // package name also contains "id"
    val code: String = "",
    val name: String = "",
    val location: String = "",
    val quantity: Int = 0,
    val unit: String = ""
) {
    companion object
}

This is what happens:
image

I believe there's a clash between id property from TransactedItem with id from package name. For now removing or renaming the id property works, maybe changing package name could work too, but it's impossible for my project.

Is there any solution?
Ignoring id property from optics could also work since I don't need it to change, but I don't know how.

ibado added a commit to ibado/arrow that referenced this issue Feb 12, 2023
@ibado
Copy link
Contributor

ibado commented Feb 12, 2023

Hello 👋 I've created a PR fixing this one. LMK what you think 🙂

@serras serras closed this as completed in 4f7fee8 Mar 1, 2023
@risalfajar
Copy link
Author

Hello @ibado, thanks for the fix last year.

But I just found out that the error still exists for ISO optics target:

public inline val id.co.company.app.features.main.transaction.tug.`data`.TransactedItem.Companion.iso: arrow.optics.Iso<id.co.company.app.features.main.transaction.tug.`data`.TransactedItem, arrow.core.Tuple7<kotlin.String, kotlin.String, kotlin.String, kotlin.String, kotlin.Int, kotlin.String, id.co.company.app.features.main.transaction.tug.`data`.ReturnDetails>> inline get() = arrow.optics.Iso(
  get = { transactedItem: id.co.company.app.features.main.transaction.tug.`data`.TransactedItem -> arrow.core.Tuple7(transactedItem.`id`, transactedItem.`code`, transactedItem.`name`, transactedItem.`unit`, transactedItem.`quantity`, transactedItem.`location`, transactedItem.`returnDetails`) },
  reverseGet = { tuple: arrow.core.Tuple7<kotlin.String, kotlin.String, kotlin.String, kotlin.String, kotlin.Int, kotlin.String, id.co.company.app.features.main.transaction.tug.`data`.ReturnDetails> -> id.co.company.app.features.main.transaction.tug.`data`.TransactedItem(tuple.first, tuple.second, tuple.third, tuple.fourth, tuple.fifth, tuple.sixth, tuple.seventh) }
)

It only happens on line 3 after the arrow ->.
Should this issue be reopened?

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

3 participants