Skip to content

Commit 59bb86b

Browse files
committed
Turn misindent error into warning
Also, fix two more tests
1 parent 12a9190 commit 59bb86b

File tree

3 files changed

+77
-77
lines changed

3 files changed

+77
-77
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ object Parsers {
606606
if (in.token == NEWLINE || in.token == NEWLINES)
607607
&& !(nextIndentWidth < startIndentWidth)
608608
then
609-
syntaxError(
609+
warning(
610610
if startIndentWidth <= nextIndentWidth then
611611
i"""Line is indented too far to the right, or a `{' is missing before:
612612
|

compiler/test/debug/Gen.scala

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,38 +126,38 @@ object Gen {
126126
|""".stripMargin
127127
}).mkString("\n\n")
128128

129-
s"""|#!/usr/bin/expect
130-
|
131-
|# log_user 1
132-
|# exp_internal 1
133-
|# set timeout 5
134-
|
135-
|send_user "spawning job...\\n"
136-
|
137-
|spawn jdb -attach 5005 -sourcepath $source
138-
|
139-
|send_user "interacting...\\n"
140-
|
141-
|expect {
142-
| "*VM Started*" { send_user "success - connected to server \\n" }
143-
| timeout {
144-
| send_user "timeout while waiting for: *VM Started*\\n"
145-
| exit 1
146-
| }
147-
|}
148-
|
149-
|send_user "setting breakpoints...\\n"
150-
|
151-
|# breakpoints
152-
|$breakpoints
153-
|
154-
|# run
155-
|send_user "run program...\\n"
156-
|send "run\\r"
157-
|expect "Breakpoint hit"
158-
|
159-
|# interactions
160-
|$commands""".stripMargin
129+
s"""|#!/usr/bin/expect
130+
|
131+
|# log_user 1
132+
|# exp_internal 1
133+
|# set timeout 5
134+
|
135+
|send_user "spawning job...\\n"
136+
|
137+
|spawn jdb -attach 5005 -sourcepath $source
138+
|
139+
|send_user "interacting...\\n"
140+
|
141+
|expect {
142+
| "*VM Started*" { send_user "success - connected to server \\n" }
143+
| timeout {
144+
| send_user "timeout while waiting for: *VM Started*\\n"
145+
| exit 1
146+
| }
147+
|}
148+
|
149+
|send_user "setting breakpoints...\\n"
150+
|
151+
|# breakpoints
152+
|$breakpoints
153+
|
154+
|# run
155+
|send_user "run program...\\n"
156+
|send "run\\r"
157+
|expect "Breakpoint hit"
158+
|
159+
|# interactions
160+
|$commands""".stripMargin
161161
}
162162

163163
def main(args: Array[String]): Unit = {

tests/patmat/patmatexhaust.scala

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
class TestSealedExhaustive { // compile only
2-
sealed abstract class Foo
2+
sealed abstract class Foo
33

4-
case class Bar(x:Int) extends Foo
5-
case object Baz extends Foo
4+
case class Bar(x:Int) extends Foo
5+
case object Baz extends Foo
66

7-
def ma1(x:Foo) = x match {
8-
case Bar(_) => // not exhaustive
9-
}
7+
def ma1(x:Foo) = x match {
8+
case Bar(_) => // not exhaustive
9+
}
1010

11-
def ma2(x:Foo) = x match {
12-
case Baz => // not exhaustive
13-
}
11+
def ma2(x:Foo) = x match {
12+
case Baz => // not exhaustive
13+
}
1414

15-
sealed abstract class Mult
16-
case class Kult(s:Mult) extends Mult
17-
case class Qult() extends Mult
15+
sealed abstract class Mult
16+
case class Kult(s:Mult) extends Mult
17+
case class Qult() extends Mult
1818

19-
def ma33(x:Kult) = x match { // exhaustive
20-
case Kult(_) => // exhaustive
21-
}
19+
def ma33(x:Kult) = x match { // exhaustive
20+
case Kult(_) => // exhaustive
21+
}
2222

23-
def ma3(x:Mult) = (x,x) match { // not exhaustive
24-
case (Kult(_), Qult()) => // Kult missing
25-
//case (Kult(_), Kult(_)) =>
26-
case (Qult(), Kult(_)) => // Qult missing
27-
//case (Qult(), Qult()) =>
28-
}
23+
def ma3(x:Mult) = (x,x) match { // not exhaustive
24+
case (Kult(_), Qult()) => // Kult missing
25+
//case (Kult(_), Kult(_)) =>
26+
case (Qult(), Kult(_)) => // Qult missing
27+
//case (Qult(), Qult()) =>
28+
}
2929

30-
def ma3u(x:Mult) = ((x,x) : @unchecked) match { // not exhaustive, but not checked!
31-
case (Kult(_), Qult()) =>
32-
case (Qult(), Kult(_)) =>
33-
}
30+
def ma3u(x:Mult) = ((x,x) : @unchecked) match { // not exhaustive, but not checked!
31+
case (Kult(_), Qult()) =>
32+
case (Qult(), Kult(_)) =>
33+
}
3434

35-
sealed abstract class Deep
35+
sealed abstract class Deep
3636

37-
case object Ga extends Deep
38-
sealed class Gp extends Deep
39-
case object Gu extends Gp
37+
case object Ga extends Deep
38+
sealed class Gp extends Deep
39+
case object Gu extends Gp
4040

41-
def zma3(x:Deep) = x match { // exhaustive!
42-
case _ =>
43-
}
44-
def zma4(x:Deep) = x match { // exhaustive!
45-
case Ga =>
46-
case _ =>
47-
}
41+
def zma3(x:Deep) = x match { // exhaustive!
42+
case _ =>
43+
}
44+
def zma4(x:Deep) = x match { // exhaustive!
45+
case Ga =>
46+
case _ =>
47+
}
4848

49-
def ma4(x:Deep) = x match { // missing cases: Gu, Gp which is not abstract so must be included
50-
case Ga =>
51-
}
49+
def ma4(x:Deep) = x match { // missing cases: Gu, Gp which is not abstract so must be included
50+
case Ga =>
51+
}
5252

53-
def ma5(x:Deep) = x match {
54-
case Gu =>
55-
case _ if 1 == 0 =>
56-
case Ga =>
57-
}
53+
def ma5(x:Deep) = x match {
54+
case Gu =>
55+
case _ if 1 == 0 =>
56+
case Ga =>
57+
}
5858

5959
def ma6() = List(1,2) match { // give up
6060
case List(1,2) =>

0 commit comments

Comments
 (0)