From 82fb1f70ab275884c42dd769b2af8f9df5389e88 Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 19 Jun 2023 20:16:39 +0200 Subject: Get rid of the .jserr pragma --- src/utils/opt.nim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/utils') diff --git a/src/utils/opt.nim b/src/utils/opt.nim index 3766516b..1a86af8e 100644 --- a/src/utils/opt.nim +++ b/src/utils/opt.nim @@ -84,9 +84,6 @@ func error*[T, E](res: Result[T, E]): E {.inline.} = res.ex template valType*[T, E](res: type Result[T, E]): auto = T template errType*[T, E](res: type Result[T, E]): auto = E -func isSameErr[T, E, F](a: type Result[T, E], b: type F): bool = - return E is F - template `?`*[T, E](res: Result[T, E]): auto = let x = res # for when res is a funcall if x.has: @@ -97,7 +94,7 @@ template `?`*[T, E](res: Result[T, E]): auto = else: when typeof(result) is Result[T, E]: return x - elif isSameErr(typeof(result), E): + elif typeof(result).errType is E: return err(x.error) else: return err() -- cgit 1.4.1-2-gfad0