Skip to content
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

warning for naked 'try' #7110

Closed
scabug opened this issue Feb 10, 2013 · 7 comments
Closed

warning for naked 'try' #7110

scabug opened this issue Feb 10, 2013 · 7 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Feb 10, 2013

try without catch or finally is probably a programmer error.

@scabug
Copy link
Author

scabug commented Feb 10, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7110?orig=1
Reporter: @retronym
Affected Versions: 2.10.0
Other Milestones: 2.11.0-M3

@scabug
Copy link
Author

scabug commented Feb 10, 2013

@retronym said:
scala/scala#2108

@scabug
Copy link
Author

scabug commented Feb 13, 2013

@JamesIry said:
Apparently the spec says it's illegal.

@scabug
Copy link
Author

scabug commented Mar 29, 2013

@retronym said:
scala/scala#2337

@scabug scabug closed this as completed Apr 3, 2013
@scabug
Copy link
Author

scabug commented Apr 3, 2013

@retronym said:
Warning added for 2.11. #4249 is a spec bug, we don't mandate braces around the try body.

@scabug
Copy link
Author

scabug commented Apr 5, 2013

@dragos said:
Why not an error? (I realize that needs updating the spec). I see no reason to ever write that code, it's always a silent bug.

@scabug
Copy link
Author

scabug commented Apr 5, 2013

@retronym said:
Two reasons:

  • There was some argument that it is convenient to comment out a catch without needing to go back up in the code and comment out the try.
  • It would be a source-incompatible change.

Personally, I agree with you (I chose to make it an unconditional warnings, rather than hiding it behind -Xlint). But a warning is sufficiently useful, so I didn't fight for anything stronger.

@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.10.2-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants