From 0dcf2ce9484bfce8e752292e5d19d5728e77646a Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Fri, 24 May 2024 10:36:43 +0100 Subject: [PATCH] Fix mdoc rendering of exercise solutions Seems to be an mdoc bug, but it was easy to work around. Turned off mdoc for some code snippets, but they are very simple and this is unlikely to cause issues in the future. Closes #83 --- book/src/pages/expressions/05-exercises.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/book/src/pages/expressions/05-exercises.md b/book/src/pages/expressions/05-exercises.md index a76256df..b9c5a1ea 100644 --- a/book/src/pages/expressions/05-exercises.md +++ b/book/src/pages/expressions/05-exercises.md @@ -66,15 +66,17 @@ Then try to check your guesses using the worksheet. If you guessed wrong, try to @:@ @:solution -```scala mdoc +```scala 1 + 2 ``` Easy example as we've seen this one before. This expression has type `Int` and evaluates to `3`. -```scala mdoc:fail +```scala 1 ? 2 +// error: +// value ? is not a member of Int ``` This is not a valid expression and does not compile. As such it doesn't have a type. @@ -91,7 +93,7 @@ This expression has type `Int` and evaluates to `2`. This expression has type `Int` and evaluates to `0`. People coming from dynamically typed languages will sometimes guess that this evaluates to `0.5` and hence the type would be a floating point number. This would require we pass information back from the run-time to compile-time, which is not possible. -```scala mdoc:fail +```scala mdoc:crash 1 / 0 ```