-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:documentationarea:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement
Milestone
Description
Compiler version
3.3.0-RC4
Minimized code
import scala.quoted.*
def test(using quotes: Quotes): Expr[Expr[Int]] =
'{ '{ 1 } }
Reproduction: https://github.com/steinybot/bug-reports/tree/dotty/wrong-staging-level-multi-stage
Output
[error] 4 | '{ '{ 1 } }
[error] | ^
[error] | access to parameter quotes from wrong staging level:
[error] | - the definition is at level 0,
[error] | - but the access is at level 1.
Expectation
According to the docs:
If the number of quotes exceeds the number of splices by more than one (effectively handling at run-time values of type Expr[Expr[T]], Expr[Expr[Expr[T]]], ...) then we talk about Multi-Stage Programming.
I thought that this example should have compiled and produces an Expr[Expr[Int]]
which I could then evaluate twice with run
.
Perhaps I have misunderstood, but if that is the case then I think the docs are misleading.
Metadata
Metadata
Assignees
Labels
area:documentationarea:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement