Skip to content

Typer failure in local recursive union types #15158

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
WojciechMazur opened this issue May 10, 2022 · 9 comments · Fixed by #15295
Closed

Typer failure in local recursive union types #15158

WojciechMazur opened this issue May 10, 2022 · 9 comments · Fixed by #15295
Assignees
Labels
area:inline area:match-types itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented May 10, 2022

Compiler version

3.2.0-RC1-bin-20220429-400427d-NIGHTLY
Works with 3.1.2

First bad commit bf937ed in #14295

Minimized code

//> using scala "3.2.0-RC1-bin-20220429-400427d-NIGHTLY"
// //> using scala "3.1.2" // Last stable working version

import scala.collection.mutable

// https://github.com/plokhotnyuk/jsoniter-scala/blob/74d6d557bf81e904d07d4b8fbead4e4cab700bea/jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala#L40-L148
class Spec {
  inline def in(testFun: => Any): Unit = {
    val _ = testFun
  }

  in {
    type JsonPrimitive = String | Int
    type Rec[JA[_], A] = A match {
      case JsonPrimitive => JsonPrimitive | JA[Rec[JA, JsonPrimitive]]
      case _ => A | JA[Rec[JA, A]]
    }

    type Json = Rec[
      [A] =>> Seq[A],
      JsonPrimitive
    ]

    val arr = new mutable.ArrayBuffer[Json](8)
  }
}

Output (click arrow to expand)

Short error message:

java.lang.AssertionError: assertion failed: no owner from  <none>/ <none> in new collection.mutable.ArrayBuffer[Json]
[info] compiling 1 Scala source to /home/wmazur/projects/virtuslab/dotty-community/jsoniter-scala/jsoniter-scala-macros/jvm/target/scala-3.2.0-RC1-bin-20220510-96ac286-NIGHTLY/test-classes ...
exception while typing new collection.mutable.ArrayBuffer[Json] of class class dotty.tools.dotc.ast.Trees$Select # -1
exception while typing new collection.mutable.ArrayBuffer[Json] of class class dotty.tools.dotc.ast.Trees$TypeApply # -1
exception while typing new collection.mutable.ArrayBuffer[Json](8) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing val arr: scala.collection.mutable.ArrayBuffer[Json] = 
  new collection.mutable.ArrayBuffer[Json](8) of class class dotty.tools.dotc.ast.Trees$ValDef # -1
exception while typing {
  type JsonPrimitive = String | Int | Double | Boolean | None.type
  type Rec = 
    
      [JA[_$1], JO[_$2], A] =>> 
        A match {
          case JsonPrimitive => JsonPrimitive | JA[Rec[JA, JO, JsonPrimitive]] |
             
          JO[Rec[JA, JO, JsonPrimitive]]
          case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
        }
    
  type Json = 
    JsonPrimitive | 
      collection.mutable.Buffer[
        Rec[collection.mutable.Buffer, [A] =>> collection.mutable.Map[String, A]
          , 
        JsonPrimitive]
      ]
     | 
      collection.mutable.Map[String, 
        Rec[collection.mutable.Buffer, [A] =>> collection.mutable.Map[String, A]
          , 
        JsonPrimitive]
      ]
    
  type JsonObject = collection.mutable.Map[String, Json]
  val arr: scala.collection.mutable.ArrayBuffer[Json] = 
    new collection.mutable.ArrayBuffer[Json](8)
  type JsonArray = collection.mutable.Buffer[Json]
  ()
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing def f$proxy1: Unit = 
  {
    type JsonPrimitive = String | Int | Double | Boolean | None.type
    type Rec = 
      
        [JA[_$1], JO[_$2], A] =>> 
          A match {
            case JsonPrimitive => JsonPrimitive | JA[Rec[JA, JO, JsonPrimitive]]
               
            | JO[Rec[JA, JO, JsonPrimitive]]
            case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
          }
      
    type Json = 
      JsonPrimitive | 
        collection.mutable.Buffer[
          Rec[collection.mutable.Buffer, 
            [A] =>> collection.mutable.Map[String, A]
          , JsonPrimitive]
        ]
       | 
        collection.mutable.Map[String, 
          Rec[collection.mutable.Buffer, 
            [A] =>> collection.mutable.Map[String, A]
          , JsonPrimitive]
        ]
      
    type JsonObject = collection.mutable.Map[String, Json]
    val arr: scala.collection.mutable.ArrayBuffer[Json] = 
      new collection.mutable.ArrayBuffer[Json](8)
    type JsonArray = collection.mutable.Buffer[Json]
    ()
  } of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing {
  val WordSpecStringWrapper_this: 
    JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
   = 
    this.convertToWordSpecStringWrapper(
      "serialize and deserialize Scala3 union types"
    )
  val AnyWordSpecLike_this: 
    
      (JsonCodecMakerNewTypeSpec.this : 
        com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMakerNewTypeSpec
      )
    
   = 
    WordSpecStringWrapper_this.
      org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
    .$asInstanceOf[
      
        (JsonCodecMakerNewTypeSpec.this : 
          com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMakerNewTypeSpec
        )
      
    ]
  def f$proxy1: Unit = 
    {
      type JsonPrimitive = String | Int | Double | Boolean | None.type
      type Rec = 
        
          [JA[_$1], JO[_$2], A] =>> 
            A match {
              case JsonPrimitive => JsonPrimitive | 
                JA[Rec[JA, JO, JsonPrimitive]]
               | JO[Rec[JA, JO, JsonPrimitive]]
              case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
            }
        
      type Json = 
        JsonPrimitive | 
          collection.mutable.Buffer[
            Rec[collection.mutable.Buffer, 
              [A] =>> collection.mutable.Map[String, A]
            , JsonPrimitive]
          ]
         | 
          collection.mutable.Map[String, 
            Rec[collection.mutable.Buffer, 
              [A] =>> collection.mutable.Map[String, A]
            , JsonPrimitive]
          ]
        
      type JsonObject = collection.mutable.Map[String, Json]
      val arr: scala.collection.mutable.ArrayBuffer[Json] = 
        new collection.mutable.ArrayBuffer[Json](8)
      type JsonArray = collection.mutable.Buffer[Json]
      ()
    }
  {
    {
      val pos$proxy1: org.scalactic.source.Position = 
        org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
          
            "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
          
        , 28)
      {
        AnyWordSpecLike_this.
          org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
        (WordSpecStringWrapper_this.inline$string, 
          List.apply[Nothing](
            scala.runtime.ScalaRunTime.genericWrapArray[Nothing]([ : Nothing])
          )
        , "in", 
          {
            def $anonfun(): Any = f$proxy1
            closure($anonfun)
          }
        , pos$proxy1)
      }
    }
  }:Unit
} of class class dotty.tools.dotc.ast.Trees$Inlined # -1
exception while typing def $anonfun(): Unit = 
  {
    val WordSpecStringWrapper_this: 
      JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
     = 
      this.convertToWordSpecStringWrapper(
        "serialize and deserialize Scala3 union types"
      )
    val AnyWordSpecLike_this: 
      
        (JsonCodecMakerNewTypeSpec.this : 
          com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMakerNewTypeSpec
        )
      
     = 
      WordSpecStringWrapper_this.
        org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
      .$asInstanceOf[
        
          (JsonCodecMakerNewTypeSpec.this : 
            com.github.plokhotnyuk.jsoniter_scala.macros.
              JsonCodecMakerNewTypeSpec
          )
        
      ]
    def f$proxy1: Unit = 
      {
        type JsonPrimitive = String | Int | Double | Boolean | None.type
        type Rec = 
          
            [JA[_$1], JO[_$2], A] =>> 
              A match {
                case JsonPrimitive => JsonPrimitive | 
                  JA[Rec[JA, JO, JsonPrimitive]]
                 | JO[Rec[JA, JO, JsonPrimitive]]
                case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
              }
          
        type Json = 
          JsonPrimitive | 
            collection.mutable.Buffer[
              Rec[collection.mutable.Buffer, 
                [A] =>> collection.mutable.Map[String, A]
              , JsonPrimitive]
            ]
           | 
            collection.mutable.Map[String, 
              Rec[collection.mutable.Buffer, 
                [A] =>> collection.mutable.Map[String, A]
              , JsonPrimitive]
            ]
          
        type JsonObject = collection.mutable.Map[String, Json]
        val arr: scala.collection.mutable.ArrayBuffer[Json] = 
          new collection.mutable.ArrayBuffer[Json](8)
        type JsonArray = collection.mutable.Buffer[Json]
        ()
      }
    {
      {
        val pos$proxy1: org.scalactic.source.Position = 
          org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
            
              "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
            
          , 28)
        {
          AnyWordSpecLike_this.
            org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
          (WordSpecStringWrapper_this.inline$string, 
            List.apply[Nothing](
              scala.runtime.ScalaRunTime.genericWrapArray[Nothing]([ : Nothing])
            )
          , "in", 
            {
              def $anonfun(): Any = f$proxy1
              closure($anonfun)
            }
          , pos$proxy1)
        }
      }
    }:Unit
  } of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing {
  def $anonfun(): Unit = 
    {
      val WordSpecStringWrapper_this: 
        JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
       = 
        this.convertToWordSpecStringWrapper(
          "serialize and deserialize Scala3 union types"
        )
      val AnyWordSpecLike_this: 
        
          (JsonCodecMakerNewTypeSpec.this : 
            com.github.plokhotnyuk.jsoniter_scala.macros.
              JsonCodecMakerNewTypeSpec
          )
        
       = 
        WordSpecStringWrapper_this.
          org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
        .$asInstanceOf[
          
            (JsonCodecMakerNewTypeSpec.this : 
              com.github.plokhotnyuk.jsoniter_scala.macros.
                JsonCodecMakerNewTypeSpec
            )
          
        ]
      def f$proxy1: Unit = 
        {
          type JsonPrimitive = String | Int | Double | Boolean | None.type
          type Rec = 
            
              [JA[_$1], JO[_$2], A] =>> 
                A match {
                  case JsonPrimitive => JsonPrimitive | 
                    JA[Rec[JA, JO, JsonPrimitive]]
                   | JO[Rec[JA, JO, JsonPrimitive]]
                  case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
                }
            
          type Json = 
            JsonPrimitive | 
              collection.mutable.Buffer[
                Rec[collection.mutable.Buffer, 
                  [A] =>> collection.mutable.Map[String, A]
                , JsonPrimitive]
              ]
             | 
              collection.mutable.Map[String, 
                Rec[collection.mutable.Buffer, 
                  [A] =>> collection.mutable.Map[String, A]
                , JsonPrimitive]
              ]
            
          type JsonObject = collection.mutable.Map[String, Json]
          val arr: scala.collection.mutable.ArrayBuffer[Json] = 
            new collection.mutable.ArrayBuffer[Json](8)
          type JsonArray = collection.mutable.Buffer[Json]
          ()
        }
      {
        {
          val pos$proxy1: org.scalactic.source.Position = 
            org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala"
              , 
            
              "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
            
            , 28)
          {
            AnyWordSpecLike_this.
              org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
            (WordSpecStringWrapper_this.inline$string, 
              List.apply[Nothing](
                scala.runtime.ScalaRunTime.genericWrapArray[Nothing](
                  [ : Nothing]
                )
              )
            , "in", 
              {
                def $anonfun(): Any = f$proxy1
                closure($anonfun)
              }
            , pos$proxy1)
          }
        }
      }:Unit
    }
  closure($anonfun:() ?=> Unit)
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing this.convertToStringShouldWrapperForVerb(
  "JsonCodecMaker.make generate codecs which"
)(
  org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
    
      "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
    
  , 27):org.scalactic.source.Position
).should(
  {
    def $anonfun(): Unit = 
      {
        val WordSpecStringWrapper_this: 
          JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
         = 
          this.convertToWordSpecStringWrapper(
            "serialize and deserialize Scala3 union types"
          )
        val AnyWordSpecLike_this: 
          
            (JsonCodecMakerNewTypeSpec.this : 
              com.github.plokhotnyuk.jsoniter_scala.macros.
                JsonCodecMakerNewTypeSpec
            )
          
         = 
          WordSpecStringWrapper_this.
            org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
          .$asInstanceOf[
            
              (JsonCodecMakerNewTypeSpec.this : 
                com.github.plokhotnyuk.jsoniter_scala.macros.
                  JsonCodecMakerNewTypeSpec
              )
            
          ]
        def f$proxy1: Unit = 
          {
            type JsonPrimitive = String | Int | Double | Boolean | None.type
            type Rec = 
              
                [JA[_$1], JO[_$2], A] =>> 
                  A match {
                    case JsonPrimitive => JsonPrimitive | 
                      JA[Rec[JA, JO, JsonPrimitive]]
                     | JO[Rec[JA, JO, JsonPrimitive]]
                    case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
                  }
              
            type Json = 
              JsonPrimitive | 
                collection.mutable.Buffer[
                  Rec[collection.mutable.Buffer, 
                    [A] =>> collection.mutable.Map[String, A]
                  , JsonPrimitive]
                ]
               | 
                collection.mutable.Map[String, 
                  Rec[collection.mutable.Buffer, 
                    [A] =>> collection.mutable.Map[String, A]
                  , JsonPrimitive]
                ]
              
            type JsonObject = collection.mutable.Map[String, Json]
            val arr: scala.collection.mutable.ArrayBuffer[Json] = 
              new collection.mutable.ArrayBuffer[Json](8)
            type JsonArray = collection.mutable.Buffer[Json]
            ()
          }
        {
          {
            val pos$proxy1: org.scalactic.source.Position = 
              org.scalactic.source.Position.apply(
                "JsonCodeMakerNewTypeSpec.scala"
              , 
                
                  "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
                
              , 28)
            {
              AnyWordSpecLike_this.
                org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
              (WordSpecStringWrapper_this.inline$string, 
                List.apply[Nothing](
                  scala.runtime.ScalaRunTime.genericWrapArray[Nothing](
                    [ : Nothing]
                  )
                )
              , "in", 
                {
                  def $anonfun(): Any = f$proxy1
                  closure($anonfun)
                }
              , pos$proxy1)
            }
          }
        }:Unit
      }
    closure($anonfun:() ?=> Unit)
  }
) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing this.convertToStringShouldWrapperForVerb(
  "JsonCodecMaker.make generate codecs which"
)(
  org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
    
      "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
    
  , 27):org.scalactic.source.Position
).should(
  {
    def $anonfun(): Unit = 
      {
        val WordSpecStringWrapper_this: 
          JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
         = 
          this.convertToWordSpecStringWrapper(
            "serialize and deserialize Scala3 union types"
          )
        val AnyWordSpecLike_this: 
          
            (JsonCodecMakerNewTypeSpec.this : 
              com.github.plokhotnyuk.jsoniter_scala.macros.
                JsonCodecMakerNewTypeSpec
            )
          
         = 
          WordSpecStringWrapper_this.
            org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
          .$asInstanceOf[
            
              (JsonCodecMakerNewTypeSpec.this : 
                com.github.plokhotnyuk.jsoniter_scala.macros.
                  JsonCodecMakerNewTypeSpec
              )
            
          ]
        def f$proxy1: Unit = 
          {
            type JsonPrimitive = String | Int | Double | Boolean | None.type
            type Rec = 
              
                [JA[_$1], JO[_$2], A] =>> 
                  A match {
                    case JsonPrimitive => JsonPrimitive | 
                      JA[Rec[JA, JO, JsonPrimitive]]
                     | JO[Rec[JA, JO, JsonPrimitive]]
                    case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
                  }
              
            type Json = 
              JsonPrimitive | 
                collection.mutable.Buffer[
                  Rec[collection.mutable.Buffer, 
                    [A] =>> collection.mutable.Map[String, A]
                  , JsonPrimitive]
                ]
               | 
                collection.mutable.Map[String, 
                  Rec[collection.mutable.Buffer, 
                    [A] =>> collection.mutable.Map[String, A]
                  , JsonPrimitive]
                ]
              
            type JsonObject = collection.mutable.Map[String, Json]
            val arr: scala.collection.mutable.ArrayBuffer[Json] = 
              new collection.mutable.ArrayBuffer[Json](8)
            type JsonArray = collection.mutable.Buffer[Json]
            ()
          }
        {
          {
            val pos$proxy1: org.scalactic.source.Position = 
              org.scalactic.source.Position.apply(
                "JsonCodeMakerNewTypeSpec.scala"
              , 
                
                  "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
                
              , 28)
            {
              AnyWordSpecLike_this.
                org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
              (WordSpecStringWrapper_this.inline$string, 
                List.apply[Nothing](
                  scala.runtime.ScalaRunTime.genericWrapArray[Nothing](
                    [ : Nothing]
                  )
                )
              , "in", 
                {
                  def $anonfun(): Any = f$proxy1
                  closure($anonfun)
                }
              , pos$proxy1)
            }
          }
        }:Unit
      }
    closure($anonfun:() ?=> Unit)
  }
)(this.subjectRegistrationFunction) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing @SourceFile(
  
    "jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala"
  
) class JsonCodecMakerNewTypeSpec() extends 
  com.github.plokhotnyuk.jsoniter_scala.macros.VerifyingSpec
() {
  this.convertToStringShouldWrapperForVerb(
    "JsonCodecMaker.make generate codecs which"
  )(
    org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
      
        "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
      
    , 27):org.scalactic.source.Position
  ).should(
    {
      def $anonfun(): Unit = 
        {
          val WordSpecStringWrapper_this: 
            JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
           = 
            this.convertToWordSpecStringWrapper(
              "serialize and deserialize Scala3 union types"
            )
          val AnyWordSpecLike_this: 
            
              (JsonCodecMakerNewTypeSpec.this : 
                com.github.plokhotnyuk.jsoniter_scala.macros.
                  JsonCodecMakerNewTypeSpec
              )
            
           = 
            WordSpecStringWrapper_this.
              org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
            .$asInstanceOf[
              
                (JsonCodecMakerNewTypeSpec.this : 
                  com.github.plokhotnyuk.jsoniter_scala.macros.
                    JsonCodecMakerNewTypeSpec
                )
              
            ]
          def f$proxy1: Unit = 
            {
              type JsonPrimitive = String | Int | Double | Boolean | None.type
              type Rec = 
                
                  [JA[_$1], JO[_$2], A] =>> 
                    A match {
                      case JsonPrimitive => JsonPrimitive | 
                        JA[Rec[JA, JO, JsonPrimitive]]
                       | JO[Rec[JA, JO, JsonPrimitive]]
                      case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
                    }
                
              type Json = 
                JsonPrimitive | 
                  collection.mutable.Buffer[
                    Rec[collection.mutable.Buffer, 
                      [A] =>> collection.mutable.Map[String, A]
                    , JsonPrimitive]
                  ]
                 | 
                  collection.mutable.Map[String, 
                    Rec[collection.mutable.Buffer, 
                      [A] =>> collection.mutable.Map[String, A]
                    , JsonPrimitive]
                  ]
                
              type JsonObject = collection.mutable.Map[String, Json]
              val arr: scala.collection.mutable.ArrayBuffer[Json] = 
                new collection.mutable.ArrayBuffer[Json](8)
              type JsonArray = collection.mutable.Buffer[Json]
              ()
            }
          {
            {
              val pos$proxy1: org.scalactic.source.Position = 
                org.scalactic.source.Position.apply(
                  "JsonCodeMakerNewTypeSpec.scala"
                , 
                  
                    "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
                  
                , 28)
              {
                AnyWordSpecLike_this.
                  org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
                (WordSpecStringWrapper_this.inline$string, 
                  List.apply[Nothing](
                    scala.runtime.ScalaRunTime.genericWrapArray[Nothing](
                      [ : Nothing]
                    )
                  )
                , "in", 
                  {
                    def $anonfun(): Any = f$proxy1
                    closure($anonfun)
                  }
                , pos$proxy1)
              }
            }
          }:Unit
        }
      closure($anonfun:() ?=> Unit)
    }
  )(this.subjectRegistrationFunction)
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing package com.github.plokhotnyuk.jsoniter_scala.macros {
  @SourceFile(
    
      "jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala"
    
  ) class JsonCodecMakerNewTypeSpec() extends 
    com.github.plokhotnyuk.jsoniter_scala.macros.VerifyingSpec
  () {
    this.convertToStringShouldWrapperForVerb(
      "JsonCodecMaker.make generate codecs which"
    )(
      org.scalactic.source.Position.apply("JsonCodeMakerNewTypeSpec.scala", 
        
          "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
        
      , 27):org.scalactic.source.Position
    ).should(
      {
        def $anonfun(): Unit = 
          {
            val WordSpecStringWrapper_this: 
              JsonCodecMakerNewTypeSpec.this.WordSpecStringWrapper
             = 
              this.convertToWordSpecStringWrapper(
                "serialize and deserialize Scala3 union types"
              )
            val AnyWordSpecLike_this: 
              
                (JsonCodecMakerNewTypeSpec.this : 
                  com.github.plokhotnyuk.jsoniter_scala.macros.
                    JsonCodecMakerNewTypeSpec
                )
              
             = 
              WordSpecStringWrapper_this.
                org$scalatest$wordspec$AnyWordSpecLike$WordSpecStringWrapper$$$outer
              .$asInstanceOf[
                
                  (JsonCodecMakerNewTypeSpec.this : 
                    com.github.plokhotnyuk.jsoniter_scala.macros.
                      JsonCodecMakerNewTypeSpec
                  )
                
              ]
            def f$proxy1: Unit = 
              {
                type JsonPrimitive = String | Int | Double | Boolean | None.type
                type Rec = 
                  
                    [JA[_$1], JO[_$2], A] =>> 
                      A match {
                        case JsonPrimitive => JsonPrimitive | 
                          JA[Rec[JA, JO, JsonPrimitive]]
                         | JO[Rec[JA, JO, JsonPrimitive]]
                        case Any => A | JA[Rec[JA, JO, A]] | JO[Rec[JA, JO, A]]
                      }
                  
                type Json = 
                  JsonPrimitive | 
                    collection.mutable.Buffer[
                      Rec[collection.mutable.Buffer, 
                        [A] =>> collection.mutable.Map[String, A]
                      , JsonPrimitive]
                    ]
                   | 
                    collection.mutable.Map[String, 
                      Rec[collection.mutable.Buffer, 
                        [A] =>> collection.mutable.Map[String, A]
                      , JsonPrimitive]
                    ]
                  
                type JsonObject = collection.mutable.Map[String, Json]
                val arr: scala.collection.mutable.ArrayBuffer[Json] = 
                  new collection.mutable.ArrayBuffer[Json](8)
                type JsonArray = collection.mutable.Buffer[Json]
                ()
              }
            {
              {
                val pos$proxy1: org.scalactic.source.Position = 
                  org.scalactic.source.Position.apply(
                    "JsonCodeMakerNewTypeSpec.scala"
                  , 
                    
                      "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature."
                    
                  , 28)
                {
                  AnyWordSpecLike_this.
                    org$scalatest$wordspec$AnyWordSpecLike$$inline$registerTestToRun
                  (WordSpecStringWrapper_this.inline$string, 
                    List.apply[Nothing](
                      scala.runtime.ScalaRunTime.genericWrapArray[Nothing](
                        [ : Nothing]
                      )
                    )
                  , "in", 
                    {
                      def $anonfun(): Any = f$proxy1
                      closure($anonfun)
                    }
                  , pos$proxy1)
                }
              }
            }:Unit
          }
        closure($anonfun:() ?=> Unit)
      }
    )(this.subjectRegistrationFunction)
  }
  final lazy module val JsonCodeMakerNewTypeSpec$package: 
    
      com.github.plokhotnyuk.jsoniter_scala.macros.
        JsonCodeMakerNewTypeSpec$package
    
   = 
    new 
      
        com.github.plokhotnyuk.jsoniter_scala.macros.
          JsonCodeMakerNewTypeSpec$package
      
    ()
  @SourceFile(
    
      "jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala"
    
  ) final module class JsonCodeMakerNewTypeSpec$package() extends Object() {
    private def writeReplace(): AnyRef = 
      new scala.runtime.ModuleSerializationProxy(
        classOf[
          com.github.plokhotnyuk.jsoniter_scala.macros.
            JsonCodeMakerNewTypeSpec$package
          .type
        ]
      )
    type Year = Int
    final lazy module val Year: 
      
        com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
          .
        Year
      
     = 
      new 
        
          com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
            .
          Year
        
      ()
    final module class Year() extends Object() {
      private def writeReplace(): AnyRef = 
        new scala.runtime.ModuleSerializationProxy(
          classOf[
            com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
              .
            Year.type
          ]
        )
      def apply(value: Int): 
        
          com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
            .
          Year
        
       = value
      def safe(value: Int): 
        
          Option[
            com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
              .
            Year
          ]
        
       = if value.>(1900) then Some.apply[Int](value) else None
      extension (
        year: 
          
            com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodeMakerNewTypeSpec$package
              .
            Year
          
      ) def value: Int = year
    }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
[info] exception occurred while compiling /home/wmazur/projects/virtuslab/dotty-community/jsoniter-scala/jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala
java.lang.AssertionError: assertion failed: no owner from  <none>/ <none> in new collection.mutable.ArrayBuffer[Json] while compiling /home/wmazur/projects/virtuslab/dotty-community/jsoniter-scala/jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodeMakerNewTypeSpec.scala
[error] ## Exception when compiling 9 sources to /home/wmazur/projects/virtuslab/dotty-community/jsoniter-scala/jsoniter-scala-macros/jvm/target/scala-3.2.0-RC1-bin-20220510-96ac286-NIGHTLY/test-classes
[error] java.lang.AssertionError: assertion failed: no owner from  <none>/ <none> in new collection.mutable.ArrayBuffer[Json]
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:699)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2834)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2928)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:795)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2884)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:814)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2865)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2238)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedValDef(Erasure.scala:884)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2838)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2928)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3020)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3070)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1029)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2873)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.typer.Typer.$anonfun$48(Typer.scala:2302)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2302)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:931)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2841)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2928)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3020)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3070)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1029)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1895)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:875)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2887)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.typer.Typer.$anonfun$48(Typer.scala:2302)
[error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2302)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:931)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2841)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2928)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3020)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3070)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1029)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2873)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$9(Erasure.scala:827)
[error] dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:151)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:827)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2865)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:814)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2865)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3047)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3070)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1029)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2507)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1019)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2853)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2857)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2928)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3020)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3070)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1029)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2636)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2898)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2929)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2994)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2998)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3114)
[error] dotty.tools.dotc.transform.Erasure.run(Erasure.scala:144)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:311)
[error] scala.collection.immutable.List.map(List.scala:246)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:312)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:225)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:236)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:244)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:253)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:253)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:186)
[error] dotty.tools.dotc.Run.compile(Run.scala:170)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:208)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] java.base/java.lang.Thread.run(Thread.java:834)
[error]            
[error] stack trace is suppressed; run last jsoniter-scala-macrosJVM / Test / compileIncremental for the full output
[error] (jsoniter-scala-macrosJVM / Test / compileIncremental) java.lang.AssertionError: assertion failed: no owner from  <none>/ <none> in new collection.mutable.ArrayBuffer[Json]
@WojciechMazur WojciechMazur added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels May 10, 2022
@nicolasstucki
Copy link
Contributor

We need a minimization that does not depend on scalatest

@nicolasstucki nicolasstucki added the stat:needs minimization Needs a self contained minimization label May 10, 2022
@WojciechMazur
Copy link
Contributor Author

@nicolasstucki I've managed to minimize it to not require scalatest, seems that issue is present due to the bug in inlining. I've updated the snippet in the issue description

@nicolasstucki nicolasstucki removed the stat:needs minimization Needs a self contained minimization label May 10, 2022
@prolativ
Copy link
Contributor

Minimized:

//> using scala "3.2.0-RC1-bin-20220429-400427d-NIGHTLY"
// //> using scala "3.1.2" // Last stable working version

inline def foo(testFun: Any): Unit = {}

val x = foo {
  type Rec[A] = A match
    case String => Option[Rec[String]]
    
  val arr = new collection.mutable.ArrayBuffer[Rec[String]](8)
}
assertion failed: no owner from  <none>/ <none> in new collection.mutable.ArrayBuffer[Option[Option[Rec[String]]]]

@prolativ
Copy link
Contributor

It looks like the clue here is that we have a recursive match type which will never get reduced and it's defined in a non-inline block passed to an inline method. But I'm still wondering why this doesn't break if I replace ArrayBuffer with some other collection.

@prolativ prolativ added area:inline regression This worked in a previous version but doesn't anymore and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 11, 2022
@bishabosha
Copy link
Member

But I'm still wondering why this doesn't break if I replace ArrayBuffer with some other collection.

it also breaks with collection.mutable.ArrayDeque

@nicolasstucki
Copy link
Contributor

The issue started in bf937ed.

@Kordyjan Kordyjan added this to the 3.1.3 milestone May 16, 2022
@odersky odersky self-assigned this May 18, 2022
@odersky
Copy link
Contributor

odersky commented May 19, 2022

My guess is that the constructor of the collection has to be overloaded for it to break.

The issue started in bf937ed.

Can you confirm this? It does not look at all related to by-name parameter handling.

@odersky odersky assigned nicolasstucki and odersky and unassigned odersky May 19, 2022
@griggt
Copy link
Contributor

griggt commented May 19, 2022

Can confirm that bisection points to bf937ed as the first bad commmit.

A reproducer without stdlib:

class Opt[T]

class Buf[A](elts: Any, sz: Int):
  def this(n: Int) = this(???, n)

inline def foo(testFun: Any): Unit = {}

val x = foo {
  type Rec[A] = A match
    case String => Opt[Rec[String]]

  val arr = new Buf[Rec[String]](8)
}

@odersky
Copy link
Contributor

odersky commented May 19, 2022

@griggt Thanks, that's good to know! I found a way to avoid the failure but am still unsure what the root cause is, and whether we should not just reject the code.

@nicolasstucki nicolasstucki removed their assignment May 20, 2022
@Kordyjan Kordyjan removed this from the 3.1.3 milestone May 24, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue May 26, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue May 26, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue May 26, 2022
@anatoliykmetyuk anatoliykmetyuk added this to the 3.1.3 milestone May 30, 2022
Kordyjan pushed a commit to dotty-staging/dotty that referenced this issue Jun 6, 2022
bishabosha pushed a commit to dotty-staging/dotty that referenced this issue Oct 18, 2022
@Kordyjan Kordyjan modified the milestones: 3.1.3, 3.2.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:inline area:match-types itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants