diff --git a/src/oi.nim b/src/oi.nim index 21c67a7..0e7539d 100644 --- a/src/oi.nim +++ b/src/oi.nim @@ -13,5 +13,5 @@ proc ok*[T](val: T): OI[T] = proc fail*(oi: OI, msg: string): OI = OI(isOK: false, error: msg) -proc fail*(msg: string): OI[auto] = - OI[auto](isOK: false, error: msg) +proc fail*[T](msg: string): OI[T] = + OI[T](isOK: false, error: msg) diff --git a/tests/testResults.nim b/tests/testResults.nim index 3be7ace..98c7334 100644 --- a/tests/testResults.nim +++ b/tests/testResults.nim @@ -8,7 +8,7 @@ test "Check OK": check test.isOk == true test "Check fail": - let test = fail "no data here" + let test = oi.fail[int] "no data here" check test.isOk == false test "Check proc results": @@ -31,7 +31,7 @@ test "Check changing result": proc checker(): OI[int] = result = ok 42 # something happend here - result = fail "data got corrupted" + result = result.fail "data got corrupted" let data = checker() check data.isOk == false