Skip to content

Fix #4006: Avoid ambiguity between SHAREDterm cases and finally #4017

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

Merged
merged 1 commit into from
Feb 22, 2018

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki
Copy link
Contributor Author

Added description of the issue in #4006

@@ -58,6 +58,7 @@ class CompilationTests extends ParallelTesting {
compileFile("tests/pos-special/i3323.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("tests/pos-special/i3323b.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("tests/pos-special/i3589-b.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("tests/pos-special/i4006.scala", defaultOptions.and("-Ytest-pickler")) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not put the test in tests/pickling?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

withLength {
pickleTree(block)
cases.foreach(pickleTree)
if (!finalizer.isEmpty) writeByte(FINALLY); pickleTreeUnlessEmpty(finalizer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!finalizer.isEmpty) {
  writeByte(FINALLY)
  pickleTree(finalizer)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will completely rewrite this code

@nicolasstucki nicolasstucki force-pushed the fix-#4006 branch 4 times, most recently from 9ce2e21 to 2268942 Compare February 20, 2018 12:01
@@ -1021,7 +1021,12 @@ class TreeUnpickler(reader: TastyReader,
val expr = ifBefore(end)(readTerm(), EmptyTree)
Return(expr, Ident(from.termRef))
case TRY =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, also add a test with no finally to exercise this path. I found tests for try ... catch but not within inline def

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@allanrenucci allanrenucci dismissed their stale review February 20, 2018 12:26

Oops, didn't mean to request changes

@odersky
Copy link
Contributor

odersky commented Feb 21, 2018

I think we should not add a new format tag. Tasty cases are a precious resource - the more we add the more people will get the impression that this is a complex format and will not work with it.

I suppose we can use unsharedTag instead to get a robust disambiguation?

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not add a new format tag. Tasty cases are a precious resource - the more we add the more people will get the impression that this is a complex format and will not work with it.

I suppose we can use unsharedTag instead to get a robust disambiguation?

@odersky odersky assigned nicolasstucki and unassigned smarter Feb 21, 2018
@nicolasstucki nicolasstucki merged commit 02725c6 into scala:master Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants