From 00fab29a6415b7007fcc73d05efba4b3551b5d2f Mon Sep 17 00:00:00 2001 From: Yubao Liu Date: Thu, 15 Feb 2024 00:01:55 +0800 Subject: [PATCH] Fixed broken code highlight on Safari of iOS 15.7.8 On iOS, the "type `A` */" is rendered as "type `A` //", it's probably a bug in webkit engine of iOS 15.7.8, newer iOS doesn't have this issue, see https://github.com/scala/docs.scala-lang/pull/2972#issuecomment-1944156374 I'm not able to find the root cause, thus change to inline comment to bypass the issue for my old iPhone 7 Plus. --- _overviews/scala3-book/ca-context-bounds.md | 8 ++++---- _zh-cn/overviews/scala3-book/ca-context-bounds.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_overviews/scala3-book/ca-context-bounds.md b/_overviews/scala3-book/ca-context-bounds.md index 2d36d7b3c..d5ed7cdf2 100644 --- a/_overviews/scala3-book/ca-context-bounds.md +++ b/_overviews/scala3-book/ca-context-bounds.md @@ -44,12 +44,12 @@ existing method `max` on `List`, but we made up this example for illustration pu {% tab 'Scala 2' %} ```scala -/** Defines how to compare values of type `A` */ +// Defines how to compare values of type `A` trait Ord[A] { def greaterThan(a1: A, a2: A): Boolean } -/** Returns the maximum of two values */ +// Returns the maximum of two values def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A = if (ord.greaterThan(a1, a2)) a1 else a2 ``` @@ -57,11 +57,11 @@ def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A = {% tab 'Scala 3' %} ```scala -/** Defines how to compare values of type `A` */ +// Defines how to compare values of type `A` trait Ord[A]: def greaterThan(a1: A, a2: A): Boolean -/** Returns the maximum of two values */ +// Returns the maximum of two values def max[A](a1: A, a2: A)(using ord: Ord[A]): A = if ord.greaterThan(a1, a2) then a1 else a2 ``` diff --git a/_zh-cn/overviews/scala3-book/ca-context-bounds.md b/_zh-cn/overviews/scala3-book/ca-context-bounds.md index 9e9c84238..418bb9ec2 100644 --- a/_zh-cn/overviews/scala3-book/ca-context-bounds.md +++ b/_zh-cn/overviews/scala3-book/ca-context-bounds.md @@ -44,12 +44,12 @@ def maxElement[A](as: List[A])(using ord: Ord[A]): A = {% tabs context-bounds-max-ord class=tabs-scala-version %} {% tab 'Scala 2' %} ```scala -/** Defines how to compare values of type `A` */ +// Defines how to compare values of type `A` trait Ord[A] { def greaterThan(a1: A, a2: A): Boolean } -/** Returns the maximum of two values */ +// Returns the maximum of two values def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A = if (ord.greaterThan(a1, a2)) a1 else a2 ``` @@ -57,11 +57,11 @@ def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A = {% tab 'Scala 3' %} ```scala -/** Defines how to compare values of type `A` */ +// Defines how to compare values of type `A` trait Ord[A]: def greaterThan(a1: A, a2: A): Boolean -/** Returns the maximum of two values */ +// Returns the maximum of two values def max[A](a1: A, a2: A)(using ord: Ord[A]): A = if ord.greaterThan(a1, a2) then a1 else a2 ```