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

CompileTests: don't help the compiler quite as much #85

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

mpollmeier
Copy link
Contributor

We want to assert that the return type is derived correctly. The way
we tested this (before this PR) gave the compiler more information
than it strictly needs, i.e. now we make the compiler's job harder, to
ensure it's always derived correctly.

We want to assert that the return type is derived correctly. The way
we tested this (before this PR) gave the compiler more information
than it strictly needs, i.e. now we make the compiler's job harder, to
ensure it's always derived correctly.
@mpollmeier mpollmeier requested a review from bbrehm October 23, 2023 06:46
@bbrehm
Copy link
Contributor

bbrehm commented Oct 23, 2023

Sorry for not spotting that earlier, but:

Why are you using intersection types here?

CallBase & StaticType[IsStaticT] is cute, but I'd feel better with the conservative type StaticCallBase = CallBase with StaticType[IsStaticT].

@mpollmeier
Copy link
Contributor Author

¯_(ツ)_/¯ I used intersection types because that's what the compiler derives them to.
I like the syntax and our use case nicely aligns with their purpose as of https://docs.scala-lang.org/scala3/book/types-intersection.html

That's just my personal preference though, I'm happy to change it, but can you add more arguments than just 'feeling better'? :)

@bbrehm
Copy link
Contributor

bbrehm commented Oct 23, 2023

My argument is basically: Scala 3 added fancy new union types that exist in scala but not the jvm. The intersection types use a similar syntax. If you encounter that as a reader, then you're forced to take a detour into language/compiler details to understand that nothing is happening. The old Foo with Bar syntax is well-known and doesn't force a hickup.

But upon reconsideration, meh, we can keep it that way with the intersection type -- afaict nothing fancy is happening here.

@mpollmeier
Copy link
Contributor Author

👍🏻 thanks for clarifying, will leave as is, and if you change your mind we can change this to old school composition

@mpollmeier mpollmeier merged commit ac07d60 into master Oct 23, 2023
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the michael/compile-tests branch October 23, 2023 12:14
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

Successfully merging this pull request may close these issues.

2 participants