Skip to content

Compiler crash when referencing type in quotes #18125

Closed
@WojciechMazur

Description

@WojciechMazur

Compiler version

Regression found in the Open Community Build in:

  • tinkoff/phobos - build logs - reproduction below

Compiler version

3.3.2-RC1-bin-20230629-90c59bd-NIGHTLY
Bisect points to b7b13e5

If you're not sure what version you're using, run print scalaVersion from sbt
(if you're running scalac manually, use scalac -version instead).

Minimized code

//> using scala 3.nightly

package oolong.phobos

import scala.quoted.*
import scala.compiletime.*
import scala.annotation.StaticAnnotation

final class xmlns[T](ns: T) extends StaticAnnotation
trait Namespace[T]{
    val getNamespace: String
}

object common{
  private def extractFeildNamespace(using Quotes)(
      fieldAnnotations: List[Expr[Any]],
  ): Expr[Option[String]] = {
    import quotes.reflect.*

    fieldAnnotations.collect { case '{ xmlns($namespace: b) } =>
      '{ Some(summonInline[Namespace[b]].getNamespace) }
    }
    ???
  }
}

Output (click arrow to expand)

//> using scala 3.nightly

package oolong.phobos

import scala.quoted.*
import scala.compiletime.*
import scala.annotation.StaticAnnotation

final class xmlns[T](ns: T) extends StaticAnnotation
trait Namespace[T]{
    val getNamespace: String
}

object common{
  private def extractFeildNamespace(using Quotes)(
      fieldAnnotations: List[Expr[Any]],
  ): Expr[Option[String]] = {
    import quotes.reflect.*

    fieldAnnotations.collect { case '{ xmlns($namespace: b) } =>
      '{ Some(summonInline[Namespace[b]].getNamespace) }
    }
    ???
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions