New hint for unused exceptions in .raises (#15492)

* New hint for unused exceptions in .raises

* Fix effects test

* Further adapt teffects1.nim
This commit is contained in:
IDF 2020-10-06 17:49:30 +03:00 • committed by GitHub
commit 9560e49e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,10 @@
discard """
cmd: "nim check $file"
nimout: '''teffects1.nim(22, 28) template/generic instantiation from here
teffects1.nim(23, 13) Error: can raise an unlisted exception: ref IOError
teffects1.nim(22, 29) Hint: 'lier' cannot raise 'IO2Error' [XCannotRaiseY]
teffects1.nim(38, 21) Error: type mismatch: got <proc (x: int): string{.noSideEffect, gcsafe, locks: 0.}> but expected 'MyProcType = proc (x: int): string{.closure.}'
.raise effects differ'''
"""
type
@ -12,7 +17,7 @@ type
proc forw: int {. .}
proc lier(): int {.raises: [IO2Error].} =
#[tt.Hint ^ 'IO2Error' is declared but not used [XDeclaredButNotUsed] ]#
#[tt.Hint ^ 'lier' cannot raise 'IO2Error' [XCannotRaiseY] ]#
writeLine stdout, "arg" #[tt.Error
^ can raise an unlisted exception: ref IOError
]#