Skip to content

Commit 8cb39e8

Browse files
committed
Remove Dsl.TryCatchFinally
1 parent 76fbb21 commit 8cb39e8

File tree

2 files changed

+1
-94
lines changed

2 files changed

+1
-94
lines changed

Dsl/src/main/scala/com/thoughtworks/dsl/Dsl.scala

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -408,61 +408,6 @@ object Dsl extends LowPriorityDsl0 {
408408
}
409409
}
410410

411-
/** The type class to support `try` ... `catch` ... `finally` expression for
412-
* `OutputDomain`.
413-
*
414-
* !-notation is allowed by default for `? !! Throwable` and
415-
* [[scala.concurrent.Future Future]] domains, with the help of this type
416-
* class.
417-
*/
418-
@implicitNotFound(
419-
"The `try` ... `catch` ... `finally` expression cannot contain !-notation inside a function that returns ${OuterDomain}."
420-
)
421-
@deprecated(
422-
"Dsl.TryCatch / Dsl.TryFinally / Dsl.TryCatchFinally will be removed",
423-
"2.0.0"
424-
)
425-
trait TryCatchFinally[Value, OuterDomain, BlockDomain, FinalizerDomain] {
426-
def tryCatchFinally(
427-
block: BlockDomain !! Value,
428-
catcher: Catcher[BlockDomain !! Value],
429-
finalizer: FinalizerDomain !! Unit,
430-
outerSuccessHandler: Value => OuterDomain
431-
): OuterDomain
432-
}
433-
434-
object TryCatchFinally {
435-
436-
implicit def fromTryCatchTryFinally[
437-
Value,
438-
OuterDomain,
439-
BlockDomain,
440-
FinalizerDomain
441-
](implicit
442-
tryFinally: TryFinally[
443-
Value,
444-
OuterDomain,
445-
BlockDomain,
446-
FinalizerDomain
447-
],
448-
tryCatch: TryCatch[Value, BlockDomain, BlockDomain]
449-
): TryCatchFinally[Value, OuterDomain, BlockDomain, FinalizerDomain] = {
450-
(
451-
block: BlockDomain !! Value,
452-
catcher: Catcher[BlockDomain !! Value],
453-
finalizer: FinalizerDomain !! Unit,
454-
outerSuccessHandler: Value => OuterDomain
455-
) =>
456-
tryFinally.tryFinally(
457-
{
458-
tryCatch.tryCatch(block, catcher, _)
459-
},
460-
finalizer,
461-
outerSuccessHandler
462-
)
463-
}
464-
}
465-
466411
@implicitNotFound(
467412
"The `try` ... `catch` expression cannot contain !-notation inside a function that returns ${OuterDomain}."
468413
)

keywords-TryCatchFinally/src/main/scala/com/thoughtworks/dsl/keywords/TryCatchFinally.scala

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ case class TryCatchFinally[+BlockKeyword, +CaseKeyword, +FinalizerKeyword](
99
cases: Catcher[CaseKeyword],
1010
finalizer: FinalizerKeyword
1111
) extends Dsl.Keyword.Trait
12-
object TryCatchFinally extends TryCatchFinally.LegacyInstances {
12+
object TryCatchFinally {
1313
given [
1414
Value,
1515
OuterDomain,
@@ -38,42 +38,4 @@ object TryCatchFinally extends TryCatchFinally.LegacyInstances {
3838
) =>
3939
TryFinally(TryCatch(block, catcher), finalizer).cpsApply(handler)
4040
}
41-
42-
trait LegacyInstances:
43-
@deprecated(
44-
"Dsl.TryCatch / Dsl.TryFinally / Dsl.TryCatchFinally will be removed",
45-
"2.0.0"
46-
)
47-
given [
48-
Value,
49-
OuterDomain,
50-
BlockKeyword,
51-
BlockDomain,
52-
CaseKeyword,
53-
FinalizerKeyword,
54-
FinalizerDomain
55-
](using
56-
dslTryCatchFinally: Dsl.TryCatchFinally[
57-
Value,
58-
OuterDomain,
59-
BlockDomain,
60-
FinalizerDomain
61-
],
62-
blockDsl: Dsl.Searching[BlockKeyword, BlockDomain, Value],
63-
caseDsl: Dsl.Searching[CaseKeyword, BlockDomain, Value],
64-
finalizerDsl: Dsl.Searching[FinalizerKeyword, FinalizerDomain, Unit]
65-
): Dsl.Composed[TryCatchFinally[
66-
BlockKeyword,
67-
CaseKeyword,
68-
FinalizerKeyword
69-
], OuterDomain, Value] = Dsl.Composed {
70-
case (TryCatchFinally(blockKeyword, cases, finalizerKeyword), handler) =>
71-
dslTryCatchFinally.tryCatchFinally(
72-
blockDsl(blockKeyword, _),
73-
cases.andThen { caseKeyword => caseDsl(caseKeyword, _) },
74-
finalizerDsl(finalizerKeyword, _),
75-
handler
76-
)
77-
}
78-
7941
}

0 commit comments

Comments
 (0)