Skip to content

Exception while typing [extremely long type here] #12194

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
aka-bash0r opened this issue Apr 22, 2021 · 2 comments · Fixed by #12206
Closed

Exception while typing [extremely long type here] #12194

aka-bash0r opened this issue Apr 22, 2021 · 2 comments · Fixed by #12206
Assignees
Milestone

Comments

@aka-bash0r
Copy link

aka-bash0r commented Apr 22, 2021

Compiler version

3.0.0-RC3

Minimized code

import scala.annotation.implicitNotFound
import scala.compiletime.package$package.summonAll
import scala.util.Try
import scala.util.Success
import scala.util.Failure
import scala.util.NotGiven
import scala.deriving.*

@main def hello(): Unit =
  println(summonAll[Tuple.Map[("foo", "bar"), ValueOf]].toList.map{
    case str: ValueOf[_]  str.value
  })

Output (click arrow to expand)

Crashes on build with sbt compile and from the IDE (stack trace is from IDE crash).

Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Searching for compilable files...
Reading compilation settings...
Compiling playground...
scalac: exception while typing {
  val Tuple_this: 
    (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
      scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
    )
   = 
    (
      {
        val res: Tuple = 
          {
            val x$2: ValueOf[("foo" : String)] = 
              {
                given val t: ValueOf[("foo" : String)] = 
                  new ValueOf[("foo" : String)]("foo")
                t:ValueOf[("foo" : String)]
              }
            {
              val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                {
                  val res: Tuple = 
                    {
                      val x$2: ValueOf[("bar" : String)] = 
                        {
                          given val t: ValueOf[("bar" : String)] = 
                            new ValueOf[("bar" : String)]("bar")
                          t:ValueOf[("bar" : String)]
                        }
                      {
                        val Tuple_this: EmptyTuple.type = EmptyTuple
                        runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                          ValueOf[("bar" : String)] *: EmptyTuple.type
                        ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                      }:Any *: Tuple
                    }
                  res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple]
                }:ValueOf[("bar" : String)] *: EmptyTuple
              runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
              ]:
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
            }:Any *: Tuple
          }
        res.asInstanceOf[
          ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
            scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
          
        ]
      }
    :
      ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
        scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
      
    )
  (
    Tuple_this.productIterator.toList.asInstanceOf[
      scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
    ]
  :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
}.map of class class dotty.tools.dotc.ast.Trees$Select # -1
scalac: exception while typing {
  val Tuple_this: 
    (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
      scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
    )
   = 
    (
      {
        val res: Tuple = 
          {
            val x$2: ValueOf[("foo" : String)] = 
              {
                given val t: ValueOf[("foo" : String)] = 
                  new ValueOf[("foo" : String)]("foo")
                t:ValueOf[("foo" : String)]
              }
            {
              val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                {
                  val res: Tuple = 
                    {
                      val x$2: ValueOf[("bar" : String)] = 
                        {
                          given val t: ValueOf[("bar" : String)] = 
                            new ValueOf[("bar" : String)]("bar")
                          t:ValueOf[("bar" : String)]
                        }
                      {
                        val Tuple_this: EmptyTuple.type = EmptyTuple
                        runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                          ValueOf[("bar" : String)] *: EmptyTuple.type
                        ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                      }:Any *: Tuple
                    }
                  res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple]
                }:ValueOf[("bar" : String)] *: EmptyTuple
              runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
              ]:
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
            }:Any *: Tuple
          }
        res.asInstanceOf[
          ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
            scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
          
        ]
      }
    :
      ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
        scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
      
    )
  (
    Tuple_this.productIterator.toList.asInstanceOf[
      scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
    ]
  :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
}.map[_] of class class dotty.tools.dotc.ast.Trees$TypeApply # -1
scalac: exception while typing {
  val Tuple_this: 
    (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
      scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
    )
   = 
    (
      {
        val res: Tuple = 
          {
            val x$2: ValueOf[("foo" : String)] = 
              {
                given val t: ValueOf[("foo" : String)] = 
                  new ValueOf[("foo" : String)]("foo")
                t:ValueOf[("foo" : String)]
              }
            {
              val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                {
                  val res: Tuple = 
                    {
                      val x$2: ValueOf[("bar" : String)] = 
                        {
                          given val t: ValueOf[("bar" : String)] = 
                            new ValueOf[("bar" : String)]("bar")
                          t:ValueOf[("bar" : String)]
                        }
                      {
                        val Tuple_this: EmptyTuple.type = EmptyTuple
                        runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                          ValueOf[("bar" : String)] *: EmptyTuple.type
                        ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                      }:Any *: Tuple
                    }
                  res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple]
                }:ValueOf[("bar" : String)] *: EmptyTuple
              runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
              ]:
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  EmptyTuple
                
            }:Any *: Tuple
          }
        res.asInstanceOf[
          ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
            scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
          
        ]
      }
    :
      ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
        scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
      
    )
  (
    Tuple_this.productIterator.toList.asInstanceOf[
      scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
    ]
  :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
}.map[_](
  {
    def $anonfun(
      x$1: 
        ValueOf[("foo" : String)] | 
          scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, Nothing, 
            [x, y] =>> x | y
          ]
        
    ): _ = 
      matchResult1[Object]: 
        {
          case val x1: (x$1 : Object) = x$1
          if x1.$isInstanceOf$[ValueOf[_] @_] then 
            {
              case val str: 
                ValueOf[("foo" : String)] & ValueOf[_] | 
                  scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                    Nothing
                  , [x, y] =>> x | y]
                 & ValueOf[_]
               = 
                x1.$asInstanceOf$[ValueOf[_] @_].$asInstanceOf$[
                  ValueOf[("foo" : String)] & ValueOf[_] | 
                    scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                      Nothing
                    , [x, y] =>> x | y]
                   & ValueOf[_]
                ]
              return[matchResult1] 
                {
                  str.value:_
                }
            }
           else ()
          throw new MatchError(x1)
        }
    closure($anonfun)
  }
) of class class dotty.tools.dotc.ast.Trees$Apply # -1
scalac: exception while typing println(
  {
    val Tuple_this: 
      (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
        scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
      )
     = 
      (
        {
          val res: Tuple = 
            {
              val x$2: ValueOf[("foo" : String)] = 
                {
                  given val t: ValueOf[("foo" : String)] = 
                    new ValueOf[("foo" : String)]("foo")
                  t:ValueOf[("foo" : String)]
                }
              {
                val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                  {
                    val res: Tuple = 
                      {
                        val x$2: ValueOf[("bar" : String)] = 
                          {
                            given val t: ValueOf[("bar" : String)] = 
                              new ValueOf[("bar" : String)]("bar")
                            t:ValueOf[("bar" : String)]
                          }
                        {
                          val Tuple_this: EmptyTuple.type = EmptyTuple
                          runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                            ValueOf[("bar" : String)] *: EmptyTuple.type
                          ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                        }:Any *: Tuple
                      }
                    res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple]
                  }:ValueOf[("bar" : String)] *: EmptyTuple
                runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                  ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                    EmptyTuple
                  
                ]:
                  ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                    EmptyTuple
                  
              }:Any *: Tuple
            }
          res.asInstanceOf[
            ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
              scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
            
          ]
        }
      :
        ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
          scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
        
      )
    (
      Tuple_this.productIterator.toList.asInstanceOf[
        scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
      ]
    :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
  }.map[_](
    {
      def $anonfun(
        x$1: 
          ValueOf[("foo" : String)] | 
            scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, Nothing, 
              [x, y] =>> x | y
            ]
          
      ): _ = 
        matchResult1[Object]: 
          {
            case val x1: (x$1 : Object) = x$1
            if x1.$isInstanceOf$[ValueOf[_] @_] then 
              {
                case val str: 
                  ValueOf[("foo" : String)] & ValueOf[_] | 
                    scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                      Nothing
                    , [x, y] =>> x | y]
                   & ValueOf[_]
                 = 
                  x1.$asInstanceOf$[ValueOf[_] @_].$asInstanceOf$[
                    ValueOf[("foo" : String)] & ValueOf[_] | 
                      scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                        Nothing
                      , [x, y] =>> x | y]
                     & ValueOf[_]
                  ]
                return[matchResult1] 
                  {
                    str.value:_
                  }
              }
             else ()
            throw new MatchError(x1)
          }
      closure($anonfun)
    }
  )
) of class class dotty.tools.dotc.ast.Trees$Apply # -1
scalac: exception while typing @main() def hello(): Unit = 
  println(
    {
      val Tuple_this: 
        (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
          scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
        )
       = 
        (
          {
            val res: Tuple = 
              {
                val x$2: ValueOf[("foo" : String)] = 
                  {
                    given val t: ValueOf[("foo" : String)] = 
                      new ValueOf[("foo" : String)]("foo")
                    t:ValueOf[("foo" : String)]
                  }
                {
                  val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                    {
                      val res: Tuple = 
                        {
                          val x$2: ValueOf[("bar" : String)] = 
                            {
                              given val t: ValueOf[("bar" : String)] = 
                                new ValueOf[("bar" : String)]("bar")
                              t:ValueOf[("bar" : String)]
                            }
                          {
                            val Tuple_this: EmptyTuple.type = EmptyTuple
                            runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                              ValueOf[("bar" : String)] *: EmptyTuple.type
                            ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                          }:Any *: Tuple
                        }
                      res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple]
                    }:ValueOf[("bar" : String)] *: EmptyTuple
                  runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                    ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                      EmptyTuple
                    
                  ]:
                    ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                      EmptyTuple
                    
                }:Any *: Tuple
              }
            res.asInstanceOf[
              ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
              
            ]
          }
        :
          ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
            scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
          
        )
      (
        Tuple_this.productIterator.toList.asInstanceOf[
          scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
        ]
      :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
    }.map[_](
      {
        def $anonfun(
          x$1: 
            ValueOf[("foo" : String)] | 
              scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, Nothing
                , 
              [x, y] =>> x | y]
            
        ): _ = 
          matchResult1[Object]: 
            {
              case val x1: (x$1 : Object) = x$1
              if x1.$isInstanceOf$[ValueOf[_] @_] then 
                {
                  case val str: 
                    ValueOf[("foo" : String)] & ValueOf[_] | 
                      scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                        Nothing
                      , [x, y] =>> x | y]
                     & ValueOf[_]
                   = 
                    x1.$asInstanceOf$[ValueOf[_] @_].$asInstanceOf$[
                      ValueOf[("foo" : String)] & ValueOf[_] | 
                        scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple
                          , 
                        Nothing, [x, y] =>> x | y]
                       & ValueOf[_]
                    ]
                  return[matchResult1] 
                    {
                      str.value:_
                    }
                }
               else ()
              throw new MatchError(x1)
            }
        closure($anonfun)
      }
    )
  ) of class class dotty.tools.dotc.ast.Trees$DefDef # -1
scalac: exception while typing @scala.annotation.internal.SourceFile(
  "C:\\Users\\User\\dev\\playground\\src\\main\\scala\\Main.scala"
) final module class Main$package$() extends Object() {
  private def writeReplace(): AnyRef = 
    new scala.runtime.ModuleSerializationProxy(classOf[Main$package.type])
  @main() def hello(): Unit = 
    println(
      {
        val Tuple_this: 
          (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
            scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
          )
         = 
          (
            {
              val res: Tuple = 
                {
                  val x$2: ValueOf[("foo" : String)] = 
                    {
                      given val t: ValueOf[("foo" : String)] = 
                        new ValueOf[("foo" : String)]("foo")
                      t:ValueOf[("foo" : String)]
                    }
                  {
                    val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                      {
                        val res: Tuple = 
                          {
                            val x$2: ValueOf[("bar" : String)] = 
                              {
                                given val t: ValueOf[("bar" : String)] = 
                                  new ValueOf[("bar" : String)]("bar")
                                t:ValueOf[("bar" : String)]
                              }
                            {
                              val Tuple_this: EmptyTuple.type = EmptyTuple
                              runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                                ValueOf[("bar" : String)] *: EmptyTuple.type
                              ]:ValueOf[("bar" : String)] *: EmptyTuple.type
                            }:Any *: Tuple
                          }
                        res.asInstanceOf[ValueOf[("bar" : String)] *: EmptyTuple
                          ]
                      }:ValueOf[("bar" : String)] *: EmptyTuple
                    runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                      ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                        EmptyTuple
                      
                    ]:
                      ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                        EmptyTuple
                      
                  }:Any *: Tuple
                }
              res.asInstanceOf[
                ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                  scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
                
              ]
            }
          :
            ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
              scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
            
          )
        (
          Tuple_this.productIterator.toList.asInstanceOf[
            scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]
          ]
        :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
      }.map[_](
        {
          def $anonfun(
            x$1: 
              ValueOf[("foo" : String)] | 
                scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                  Nothing
                , [x, y] =>> x | y]
              
          ): _ = 
            matchResult1[Object]: 
              {
                case val x1: (x$1 : Object) = x$1
                if x1.$isInstanceOf$[ValueOf[_] @_] then 
                  {
                    case val str: 
                      ValueOf[("foo" : String)] & ValueOf[_] | 
                        scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple
                          , 
                        Nothing, [x, y] =>> x | y]
                       & ValueOf[_]
                     = 
                      x1.$asInstanceOf$[ValueOf[_] @_].$asInstanceOf$[
                        ValueOf[("foo" : String)] & ValueOf[_] | 
                          scala.Tuple.Fold[ValueOf[("bar" : String)] *: 
                            EmptyTuple
                          , Nothing, [x, y] =>> x | y]
                         & ValueOf[_]
                      ]
                    return[matchResult1] 
                      {
                        str.value:_
                      }
                  }
                 else ()
                throw new MatchError(x1)
              }
          closure($anonfun)
        }
      )
    )
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
scalac: exception while typing package <empty> {
  final lazy module val Main$package: Main$package$ = new Main$package$()
  @scala.annotation.internal.SourceFile(
    "C:\\Users\\User\\dev\\playground\\src\\main\\scala\\Main.scala"
  ) final module class Main$package$() extends Object() {
    private def writeReplace(): AnyRef = 
      new scala.runtime.ModuleSerializationProxy(classOf[Main$package.type])
    @main() def hello(): Unit = 
      println(
        {
          val Tuple_this: 
            (ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
              scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
            )
           = 
            (
              {
                val res: Tuple = 
                  {
                    val x$2: ValueOf[("foo" : String)] = 
                      {
                        given val t: ValueOf[("foo" : String)] = 
                          new ValueOf[("foo" : String)]("foo")
                        t:ValueOf[("foo" : String)]
                      }
                    {
                      val Tuple_this: ValueOf[("bar" : String)] *: EmptyTuple = 
                        {
                          val res: Tuple = 
                            {
                              val x$2: ValueOf[("bar" : String)] = 
                                {
                                  given val t: ValueOf[("bar" : String)] = 
                                    new ValueOf[("bar" : String)]("bar")
                                  t:ValueOf[("bar" : String)]
                                }
                              {
                                val Tuple_this: EmptyTuple.type = EmptyTuple
                                runtime.Tuples.cons(x$2, Tuple_this).
                                  asInstanceOf
                                [ValueOf[("bar" : String)] *: EmptyTuple.type]:
                                  ValueOf[("bar" : String)] *: EmptyTuple.type
                              }:Any *: Tuple
                            }
                          res.asInstanceOf[
                            ValueOf[("bar" : String)] *: EmptyTuple
                          ]
                        }:ValueOf[("bar" : String)] *: EmptyTuple
                      runtime.Tuples.cons(x$2, Tuple_this).asInstanceOf[
                        ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] 
                          *:
                         EmptyTuple
                      ]:
                        ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] 
                          *:
                         EmptyTuple
                    }:Any *: Tuple
                  }
                res.asInstanceOf[
                  ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                    scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf
                      ]
                  
                ]
              }
            :
              ValueOf[("foo" : String)] *: ValueOf[("bar" : String)] *: 
                scala.Tuple.Map[scala.Tuple$package.EmptyTuple.type, ValueOf]
              
            )
          (
            Tuple_this.productIterator.toList.asInstanceOf[
              
                scala.collection.immutable.List[
                  Tuple.Union[(Tuple_this : Product)]
                ]
              
            ]
          :scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]])
        }.map[_](
          {
            def $anonfun(
              x$1: 
                ValueOf[("foo" : String)] | 
                  scala.Tuple.Fold[ValueOf[("bar" : String)] *: EmptyTuple, 
                    Nothing
                  , [x, y] =>> x | y]
                
            ): _ = 
              matchResult1[Object]: 
                {
                  case val x1: (x$1 : Object) = x$1
                  if x1.$isInstanceOf$[ValueOf[_] @_] then 
                    {
                      case val str: 
                        ValueOf[("foo" : String)] & ValueOf[_] | 
                          scala.Tuple.Fold[ValueOf[("bar" : String)] *: 
                            EmptyTuple
                          , Nothing, [x, y] =>> x | y]
                         & ValueOf[_]
                       = 
                        x1.$asInstanceOf$[ValueOf[_] @_].$asInstanceOf$[
                          ValueOf[("foo" : String)] & ValueOf[_] | 
                            scala.Tuple.Fold[ValueOf[("bar" : String)] *: 
                              EmptyTuple
                            , Nothing, [x, y] =>> x | y]
                           & ValueOf[_]
                        ]
                      return[matchResult1] 
                        {
                          str.value:_
                        }
                    }
                   else ()
                  throw new MatchError(x1)
                }
            closure($anonfun)
          }
        )
      )
  }
  @scala.annotation.internal.SourceFile(
    "C:\\Users\\User\\dev\\playground\\src\\main\\scala\\Main.scala"
  ) final class hello() extends Object() {
    <static> def main(args: Array[String]): Unit = 
      try Main$package.hello() catch 
        {
          case error @ _:scala.util.CommandLineParser.ParseError => 
            scala.util.CommandLineParser.showError(error)
        }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
scalac: java.lang.AssertionError: assertion failed:  <none> while compiling C:\Users\User\dev\playground\src\main\scala\Main.scala
scalac: exception occurred while compiling C:\Users\User\dev\playground\src\main\scala\Main.scala

scalac: Error: assertion failed:  <none>
java.lang.AssertionError: assertion failed:  <none>
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:721)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2639)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2730)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2916)
	at dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:815)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2688)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2731)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2916)
	at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:837)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2669)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2731)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2916)
	at dotty.tools.dotc.transform.Erasure$Typer.$anonfun$4(Erasure.scala:850)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:153)
	at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:850)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2669)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2731)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2916)
	at dotty.tools.dotc.typer.Typer.$anonfun$34(Typer.scala:2142)
	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2142)
	at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:955)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2646)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2730)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2822)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2872)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1068)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2328)
	at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1057)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2657)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2661)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2730)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2822)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2872)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1068)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2451)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2702)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2731)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2796)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2800)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2916)
	at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:132)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:303)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:304)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:215)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:223)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:230)
	at dotty.tools.dotc.Run.compileSources(Run.scala:166)
	at dotty.tools.dotc.Run.compile(Run.scala:150)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
	at dotty.tools.dotc.Driver.process(Driver.scala:199)
	at dotty.tools.dotc.Main.process(Main.scala)
	at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
	at xsbt.CompilerInterface.run(CompilerInterface.java:41)
	at jdk.internal.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at sbt.internal.inc.AnalyzingCompiler.invoke(AnalyzingCompiler.scala:315)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:110)
	at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:57)
	at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:43)
	at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:158)
	at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:141)
	at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:131)
	at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:138)
	at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:115)
	at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:71)
	at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
	at jdk.internal.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Checking dependencies... [playground]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'playground'
Searching for compilable files...
Running 'after' tasks
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
22/04/2021 19:58 - Build completed with 1 error and 8 warnings in 2 sec, 201 ms
@nicolasstucki
Copy link
Contributor

Minimized

def test(): Unit =
  (??? : Tuple1[ValueOf["foo"]]).toList.map(identity)

Seems to be related to the return type of toList which is List[Tuple.Union[this.type]].

Workaround

def test(): Unit =
  val t = (??? : Tuple1[ValueOf["foo"]])
  t.toList.map(identity)

@odersky
Copy link
Contributor

odersky commented Apr 23, 2021

The following fails again:

var t = (??? : Tuple1[ValueOf["foo"]]); t.toList.map(identity)

So it has to do with the fact whether the prefix to toList is stable or not. Tuple#toList mentions this.type in its result type, so this could be related.

odersky added a commit to dotty-staging/dotty that referenced this issue Apr 23, 2021
Avoid steps can yield match types that should be normalized to keep things clean. This means
avoidance does the same steps as simplification in this respect.

Fixes scala#12194
@odersky odersky mentioned this issue Apr 23, 2021
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 24, 2021
Avoid steps can yield match types that should be normalized to keep things clean. This means
avoidance does the same steps as simplification in this respect.

Fixes scala#12194
michelou pushed a commit to michelou/scala3 that referenced this issue May 1, 2021
Avoid steps can yield match types that should be normalized to keep things clean. This means
avoidance does the same steps as simplification in this respect.

Fixes scala#12194
liufengyun pushed a commit to dotty-staging/dotty that referenced this issue May 3, 2021
Avoid steps can yield match types that should be normalized to keep things clean. This means
avoidance does the same steps as simplification in this respect.

Fixes scala#12194
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 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.

4 participants