8000 Merge pull request scala/scala#11000 from NthPortal/using-pref/PR · scala/scala3@62d069e · GitHub
[go: up one dir, main page]

Skip to content

Commit 62d069e

Browse files
authored
Merge pull request scala/scala#11000 from NthPortal/using-pref/PR
Improve `s.u.Using` suppression order
2 parents 0b53939 + 3d60f54 commit 62d069e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/src/scala/util/Using.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ import scala.util.control.{ControlThrowable, NonFatal}
125125
* - `java.lang.LinkageError`
126126
* - `java.lang.InterruptedException` and `java.lang.ThreadDeath`
127127
* - [[scala.util.control.NonFatal fatal exceptions]], excluding `scala.util.control.ControlThrowable`
128+
* - all other exceptions, excluding `scala.util.control.ControlThrowable`
128129
* - `scala.util.control.ControlThrowable`
129-
* - all other exceptions
130130
*
131131
* When more than two exceptions are thrown, the first two are combined and
132132
* re-thrown as described above, and each successive exception thrown is combined
@@ -265,9 +265,9 @@ object Using {
265265
case _: VirtualMachineError => 4
266266
case _: LinkageError => 3
267267
case _: InterruptedException | _: ThreadDeath => 2
268-
case _: ControlThrowable => 0
268+
case _: ControlThrowable => -1 // below everything
269269
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
270-
case _ => -1
270+
case _ => 0
271271
}
272272
@inline def suppress(t: Throwable, suppressed: Throwable): Throwable = { t.addSuppressed(suppressed); t }
273273

0 commit comments

Comments
 (0)
0