Skip to content

scala.MatchError on 0.25.0-bin-20200608-fa84627-NIGHTLY #9150

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
letalvoj opened this issue Jun 9, 2020 · 5 comments · Fixed by #9154
Closed

scala.MatchError on 0.25.0-bin-20200608-fa84627-NIGHTLY #9150

letalvoj opened this issue Jun 9, 2020 · 5 comments · Fixed by #9154
Assignees

Comments

@letalvoj
Copy link

letalvoj commented Jun 9, 2020

Mimimized example

import scala.compiletime.erasedValue

inline def fooErased[T] = inline erasedValue[T] match { case _ => }
val f = fooErased[EmptyTuple]

Output

Exception in thread "main" scala.MatchError: TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module Tuple$package),type EmptyTuple) (of class dotty.tools.dotc.core.Types$CachedTypeRef)
        at dotty.tools.dotc.ast.tpd$.singleton(tpd.scala:429)
        at dotty.tools.dotc.typer.Inliner.$anonfun$3(Inliner.scala:682)
        at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:79)
        at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:116)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1358)
        at scala.collection.immutable.List.mapConserve(List.scala:472)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1358)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformSub(Trees.scala:1362)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1279)
@smarter smarter added stat:needs minimization Needs a self contained minimization area:metaprogramming and removed stat:needs minimization Needs a self contained minimization labels Jun 9, 2020
@letalvoj
Copy link
Author

@smarter I run bisect and it is caused by #9049

@letalvoj
Copy link
Author

Can be furthe minimized ^^ I updated the example.

@nicolasstucki
Copy link
Contributor

It does not look like #9049 introduced the issue. It can be reproduced with any other alias to an object.

import scala.compiletime.erasedValue

type Foo = Foo.type
object Foo

inline def fooErased[T] = inline erasedValue[T] match { case _ => }
val f = fooErased[Foo]

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 10, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 10, 2020
@letalvoj
Copy link
Author

@nicolasstucki yeah, my example was not "minimal" enough...

Changing the Unit -> EmptyTuple just exposed the issue in the case where you match erasedValue of an empty MirrorElemLabels tuple. That was the example I used for in git bisect.

@nicolasstucki
Copy link
Contributor

I found the cause. #9154 should fix it.

@nicolasstucki nicolasstucki linked a pull request Jun 10, 2020 that will close this issue
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 10, 2020
nicolasstucki added a commit that referenced this issue Jun 10, 2020
Fix #9150: Dealias reference to singleton
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.

3 participants