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

Avoid orphan param from default arg #21824

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Conversation

dwijnand
Copy link
Member

Fixes #21558

@dwijnand dwijnand marked this pull request as ready for review October 25, 2024 08:51
@dwijnand
Copy link
Member Author

@EugeneFlesselle ping, any chance you can review this please?

@dwijnand dwijnand requested review from SethTisue and removed request for EugeneFlesselle November 6, 2024 13:31
@dwijnand dwijnand assigned SethTisue and unassigned EugeneFlesselle Nov 6, 2024
Copy link
Member

@SethTisue SethTisue left a comment

Choose a reason for hiding this comment

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

I don't know these APIs well, but I can't think of any objection to raise, either.

@SethTisue SethTisue removed their assignment Nov 6, 2024
@dwijnand dwijnand merged commit fb48239 into scala:main Nov 12, 2024
28 checks passed
@dwijnand dwijnand deleted the orphan-param-spree branch November 12, 2024 09:25
@WojciechMazur
Copy link
Contributor

@dwijnand
Bisect points to this PR as cause of OpnCB failures in geirolz/toolkit - build logs
I was not able to correctly minimize the issue - the copyWith method seems to have some weird inference with the rest of the repository - copy of this method under a different name leads to compilation failure (missing implicit of AppContext.NoDeps)
My guess is that project previously compiled only because it was taking advantage of hidden unsoundness bug.

What's also interesting when using = this.depsLoader.asInstanceOf leads to a crash of the compiler in pickler due to orphan paramterer refrence. Here's reproducer

trait AppContext[CONFIG, DEPENDENCIES]
object AppContext:
  sealed trait NoDependencies
  type NoDeps[CONFIG] = AppContext[CONFIG, NoDependencies]

trait Resource[F[_], +T]
type \/[+A, +B] = Either[A, B]
given [A, B]: AppContext[A, B] = ???

class App[F[+_], FAILURE, CONFIG, DEPENDENCIES](
    val depsLoader: AppContext.NoDeps[CONFIG] ?=> Resource[F, FAILURE \/ DEPENDENCIES]
) {
  def copyWith[G[+_], FAILURE2, CONFIG2, DEPS2](
      dependenciesLoader: AppContext.NoDeps[CONFIG2] ?=> Resource[G, FAILURE2 \/ DEPS2] = this.depsLoader.asInstanceOf
  ): App[G, FAILURE2, CONFIG2, DEPS2] = ???
}

FYI @geirolz

@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Nov 25, 2024
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.

assertion failed: orphan parameter reference during pickling
4 participants