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
import files
from handles importFD#import handles <- do this and it workslet wr =newFile(FD-1)
close wr
Current Output
test.nim(6, 7) template/generic instantiation of `close` from here
files.nim(8, 11) Error: type mismatch: got <Handle[handles.FD]>
but expected one of:
proc close(f: File)
first type mismatch at position: 1
required type for f: File
but expression 'f.handle' is of type: Handle[handles.FD]
proc close(fd: FD)
first type mismatch at position: 1
required type for fd: FD
but expression 'f.handle' is of type: Handle[handles.FD]
proc close[T: AnyFD](h: var Handle[T])
first type mismatch at position: 1
required type for h: var Handle[close.T]
but expression 'f.handle' is of type: Handle[handles.FD]
test.nim(6, 7) template/generic instantiation of `close` from here
handles.nim(6, 10) AnyFD: type mismatch: got <Alias>
but expected one of:
proc close(f: File)
first type mismatch at position: 1
required type for f: File
but expression 'fd' is of type: Alias
proc close[T: File](f: T)
first type mismatch at position: 1
required type for f: T: File
but expression 'fd' is of type: Alias
expression: close(fd)
proc close[T: File](f: T)
first type mismatch at position: 1
required type for f: T: File
but expression 'f.handle' is of type: Handle[handles.FD]
expression: close(f.handle)
$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-01-15
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 7b632f9ccbd4d15fa9fe4ca45b6fea22b259c81d
active boot switches: -d:release -d:nimUseLinenoise
The text was updated successfully, but these errors were encountered:
I would be surprised if it's not another instance of Generic sandwiches #11225. (tag #8677). I.e. not due to concept but by how generics are implemented and how generic (early) symbol resolution works.
Example
handles.nim
:files.nim
:test.nim
:Current Output
Additional Information
The text was updated successfully, but these errors were encountered: