-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Quotation unexpectedly creates cyclic structures #5376
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
Labels
Comments
The issue is with the current semantics the contents of the ~ are evaluated lazily and it is evaluated on the call to show. There the code is '(~e + 1) where it resolves the inner e as '(~e + 1) constructing '((~e + 1) + 1) and so on. |
The simple workaround is to use a |
I added a test to #5297 which confirms that this is fixed there. |
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 12, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 13, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 19, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 21, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 22, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 22, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 29, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 29, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 7, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 7, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 7, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 17, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 17, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 17, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 17, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 18, 2018
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 7, 2019
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 7, 2019
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 8, 2019
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 5, 2019
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
May 7, 2019
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 30, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 30, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 31, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 31, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 31, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 1, 2019
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 1, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's currently easy using quotation to inadvertently create a cyclic structure that fails when it's used. For example, the following code fails with a
StackOverflowError
on the call toshow
:@nicolasstucki tells me that this is likely to be fixed by the code in #5297, which makes the evaluation of quotations more eager.
The text was updated successfully, but these errors were encountered: