Skip to content

Fix #1792: Allow newline in front of { for procedure syntax #1822

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
Dec 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,7 @@ object Parsers {
if (in.token == THIS) {
in.nextToken()
val vparamss = paramClauses(nme.CONSTRUCTOR)
if (in.isScala2Mode) newLineOptWhenFollowedBy(LBRACE)
val rhs = {
if (!(in.token == LBRACE && scala2ProcedureSyntax(""))) accept(EQUALS)
atPos(in.offset) { constrExpr() }
Expand All @@ -1908,6 +1909,7 @@ object Parsers {
val tparams = typeParamClauseOpt(ParamOwner.Def)
val vparamss = paramClauses(name)
var tpt = fromWithinReturnType(typedOpt())
if (in.isScala2Mode) newLineOptWhenFollowedBy(LBRACE)
val rhs =
if (in.token == EQUALS) {
in.nextToken()
Expand Down
8 changes: 8 additions & 0 deletions tests/pos-scala2/i1792.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object Test {

def foo(x: Int)
{
x
}

}