Skip to content

Failure when beta-reducing polymorphic function #17052

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

Closed
nicolasstucki opened this issue Mar 6, 2023 · 0 comments · Fixed by #17054
Closed

Failure when beta-reducing polymorphic function #17052

nicolasstucki opened this issue Mar 6, 2023 · 0 comments · Fixed by #17054

Comments

@nicolasstucki
Copy link
Contributor

Compiler version

3.3-RC2

Minimized code

def test[F[_]](fAny: F[Any]) =
  { [X] => (fx: F[X]) => { val fx2: F[X] = fx; () } }.apply[Any](fAny)

Output

With -Ycheck:all

exception while typing val fx2: F[X] = fAny of class class dotty.tools.dotc.ast.Trees$ValDef # -1
exception while typing {
  val fx2: F[X] = fAny
  ()
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing {
  type X = Any
  {
    val fx2: F[X] = fAny
    ()
  }
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing def test[F[_$1]](fAny: F[Any]): Unit =
  {
    type X = Any
    {
      val fx2: F[X] = fAny
      ()
    }
  } of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing @SourceFile("t/Macro_1.scala") final module class Macro_1$package() extends Object() {
  private def writeReplace(): AnyRef = new scala.runtime.ModuleSerializationProxy(classOf[Macro_1$package.type])
  def test[F[_$1]](fAny: F[Any]): Unit =
    {
      type X = Any
      {
        val fx2: F[X] = fAny
        ()
      }
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing package <empty> {
  final lazy module val Macro_1$package: Macro_1$package = new Macro_1$package()
  @SourceFile("t/Macro_1.scala") final module class Macro_1$package() extends Object() {
    private def writeReplace(): AnyRef = new scala.runtime.ModuleSerializationProxy(classOf[Macro_1$package.type])
    def test[F[_$1]](fAny: F[Any]): Unit =
      {
        type X = Any
        {
          val fx2: F[X] = fAny
          ()
        }
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
*** error while checking t/Macro_1.scala after phase MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkStatic, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks} ***
java.lang.AssertionError: assertion failed: Found:    (fAny : F[Any])
Required: F[X]
found: ??
expected: ??
tree = fAny while running Ycheck on t/Macro_1.scala
exception occurred while compiling t/Macro_1.scala
java.lang.AssertionError: assertion failed: Found:    (fAny : F[Any])
Required: F[X]
found: ??
expected: ??
tree = fAny while compiling t/Macro_1.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Found:    (fAny : F[Any])
Required: F[X]
found: ??
expected: ??
tree = fAny

Expectation

Should pass -Ycheck:all.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 6, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 6, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 7, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 8, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 8, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2023
Dedelweiss pushed a commit to Dedelweiss/dotty that referenced this issue Apr 17, 2023
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants