aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
diff options
context:
space:
mode:
authorSebastian Harko <sebastian.harko@lightbend.com>2016-10-25 07:51:21 -0700
committerSebastian Harko <sebastian.harko@lightbend.com>2016-10-25 07:51:21 -0700
commit6660729efd3d8d74db0614947d30b3b6c08484c0 (patch)
treed456bdb2c9a92e0e5b7ae25b8840d77f77502603 /src/dotty/tools/dotc/reporting/diagnostic/messages.scala
parentef0d2913a628e3ce06bc81942dc236170aa744c1 (diff)
downloaddotty-6660729efd3d8d74db0614947d30b3b6c08484c0.tar.gz
dotty-6660729efd3d8d74db0614947d30b3b6c08484c0.tar.bz2
dotty-6660729efd3d8d74db0614947d30b3b6c08484c0.zip
break lines
Diffstat (limited to 'src/dotty/tools/dotc/reporting/diagnostic/messages.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/diagnostic/messages.scala25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index 264479467..303ab0437 100644
--- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -515,34 +515,31 @@ object messages {
case class YieldOrDoExpectedInForComprehension()(implicit ctx: Context) extends Message(19) {
val kind = "Syntax"
val msg = hl"${"yield"} or ${"do"} expected"
-
- val code1 = "val numbers = for i <- 1 to 3 yield i"
- val code2 = "val numbers = for (i <- 1 to 3) yield i"
- val code3 = "for (i <- 1 to 3) println(i)"
- val code4 = "for i <- 1 to 3 do println(i) // notice the 'do' keyword"
-
+
val explanation =
- hl"""When the enumerators in a for comprehension are not placed in parentheses or braces, a ${"do"} or ${"yield"} statement
- |is required after the enumerators section of the comprehension.
+ hl"""When the enumerators in a for comprehension are not placed in parentheses or
+ |braces, a ${"do"} or ${"yield"} statement is required after the enumerators section
+ |of the comprehension.
|
|You can save some keystrokes by omitting the parentheses and writing
|
- |$code1
+ |${"val numbers = for i <- 1 to 3 yield i"}
|
| instead of
|
- |$code2
+ |${"val numbers = for (i <- 1 to 3) yield i"}
|
|but the ${"yield"} keyword is still required.
|
- |For comprehensions that simply perform a side effect without yielding anything can also be written without parentheses
- |but a ${"do"} keyword has to be included. For example,
+ |For comprehensions that simply perform a side effect without yielding anything
+ |can also be written without parentheses but a ${"do"} keyword has to be included.
+ |For example,
|
- |$code3
+ |${"for (i <- 1 to 3) println(i)"}
|
| can be written as
|
- |$code4
+ |${"for i <- 1 to 3 do println(i) // notice the 'do' keyword"}
|
|""".stripMargin
}