Skip to content

Restore old implementation of *: on Scala 3 to restore compatibility with opaque types#171

Merged
mpilquist merged 4 commits into
mainfrom
topic/fix-opaque-types
Apr 21, 2026
Merged

Restore old implementation of *: on Scala 3 to restore compatibility with opaque types#171
mpilquist merged 4 commits into
mainfrom
topic/fix-opaque-types

Conversation

@mpilquist
Copy link
Copy Markdown
Member

@mpilquist mpilquist commented Apr 21, 2026

Fixes #146.

The implementation of *: introduced in #140 relied on a match type:

type Prepend[A, B] = B match
  case Tuple => A *: B
  case _     => A *: B *: EmptyTuple

Given a Prepend[X, Y] where Y is an opaque type (or like in the original report in #146, an abstract type), the compiler cannot refute that Y is a Tuple so does no further reduction beyond Prepend[X, Y].

Hence, the technique based on Prepend is fundamentally flawed. This PR restores the older implementation based on implicit classes.


trait TwiddleSyntax[F[_]]:

given twiddlesPrependOps: Twiddles.PrependOps[F] with {}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safe to drop completely as its only utility was providing compile time access to the inline extension methods from PrependOps.

@mpilquist mpilquist merged commit 0fcf5d0 into main Apr 21, 2026
23 checks passed
@mpilquist mpilquist deleted the topic/fix-opaque-types branch April 21, 2026 00:52
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.

Investigate skunk compilation error after upgrading to 1.0.0-RC2

1 participant