You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code compiles and runs ok, but nimsuggest complains about function calls in assert lines (last two):
typeMaybeS=enumNothing, JusttypeMaybe[T] =tuple[fst:MaybeS,snd:T]
procfromMaybe[T](self:Maybe[T],a:T) : T =if self[0] ==Nothing :
return a
else :
return self[1]
procfromJust[T](self:Maybe[T]) : T =if self.fst ==Just :
return self.snd
else :
raisenewException(IOError,"not Just")
let nothing : Maybe[int] = (Nothing,0)
let something : Maybe[int] = (Just,2)
assertfromMaybe(nothing,10) ==10assertfromJust(something) ==2
Running directly with nimsuggest from terminal return this:
chk skUnknown Error /home/thadeu/Nim/learn/types.nim 156 17 "type mismatch: got <Maybe[system.int]>\x0Abut expected one of:\x0Aproc fromJust[T](s: Maybe[T]): T\x0A first type mismatch at position: 1\x0A required type for s: Maybe[fromJust.T]\x0A but expression \'something\' is of type: Maybe[system.int]\x0A\x0Aexpression: fromJust(something)" 0
Nim version: 1.6.4 (installed with choosenim)
The text was updated successfully, but these errors were encountered:
The following code compiles and runs ok, but nimsuggest complains about function calls in assert lines (last two):
Running directly with nimsuggest from terminal return this:
Nim version: 1.6.4 (installed with choosenim)
The text was updated successfully, but these errors were encountered: