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

compiler accepts 'try' with a simple expression which is not allowed in the spec #4249

Closed
scabug opened this issue Feb 14, 2011 · 6 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 14, 2011

=== What steps will reproduce the problem ===

try 1

=== What is the expected behavior? ===

The code should not compile. The compiler should give a compilation error.

The syntax specified in the specification, section 6.22, requires a block inside curly braces after the try keyword. A simple expression after try is not allowed.

=== What do you see instead? ===

scala> try 1
res0: Int = 1

=== What versions of the following are you using? ===

  • Scala: 2.8.1
  • Java: 1.6.0_21
  • Operating system: Windows Vista
@scabug
Copy link
Author

scabug commented Feb 14, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4249?orig=1
Reporter: Grzegorz Balcerek (grzebal)
See #7110

@scabug
Copy link
Author

scabug commented Feb 14, 2011

@paulp said:
It's the specification which needs updating. (And also for catch, which can take any expression of the right type.)

@scabug
Copy link
Author

scabug commented Feb 13, 2013

@JamesIry said:
Jason was working on a warning for "try(expr)" because it's too easy to accidentally type that when you meant "Try(expr)'

@scabug
Copy link
Author

scabug commented Feb 13, 2013

@JamesIry said:
See #7110

@scabug
Copy link
Author

scabug commented Oct 15, 2013

@gkossakowski said:
Unassigning and rescheduling to M7 as previous deadline was missed.

@scabug scabug closed this as completed Mar 12, 2014
@scabug
Copy link
Author

scabug commented Mar 12, 2014

@adriaanm said:
Updated in markdown spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants