Skip to content

Illegal quote/splice syntax passing through parser #13951

Closed
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.1.1

Minimized code

import scala.quoted.*

def q1(using Quotes): Expr[Int] = '{ 1 }
def q2(using Quotes): Expr[Int] = ' { 1 } // compiles but should not
def q3(using Quotes): Expr[Int] = '{ ${ foo } }
def q4(using Quotes): Expr[Int] = '{ $ { foo } } // compiles but should not

Expectation

They should have the same syntactic rules as string interpolators. ' or $ must be immediately followed by a {.

For examples the equivalent string interpolators

def s1 = s"abc"
def s2 = s "abc" // does not compile
def s3 = s"<${"abc"}>"
def s4 = s"<$ {"abc"}>" // does not compile

Also see

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions