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

Opaque type residing in the same package object as Newtype/Subtype breaks compilation #1167

Open
m-kalai opened this issue Jul 21, 2023 · 2 comments
Assignees

Comments

@m-kalai
Copy link

m-kalai commented Jul 21, 2023

I created simple-as-possible repo to demonstrate this issue -> https://github.com/m-kalai/zio-prelude-opaque-issue

When issue.test.model#Whatever type is just ordinary type alias, code compiles. When this same type becomes opaque type, code compilation fails with:

We were unable to read your assertion at compile-time.

You must either define your assertion directly or refer to other inline definitions:

    override inline def assertion = greaterThan(10) && lessThan(100).

    or

    inline def extracted = greaterThan(10) && lessThan(100).
    override inline def assertion = extracted.

It fails for both CustomerId and CustomerName.

Expected result would be that code compiles. Also this behaviour seems to be exclusive to package objects.

I'd like to help with the fix but i need some guidance.

@sideeffffect
Copy link
Member

Let me try to summon @kitlangton , maybe he'll be able to help.

@ktonga
Copy link

ktonga commented Oct 28, 2024

I'm also seeing this.

In my experience it's not exclusive to package objects but it happens when the opaque type is defined within the same file as the newtypes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants