Issue with isNil
opened this issue · comments
The following code currently refuses to compile with the error /home/tay/.nimble/pkgs/ormin-0.1.0/ormin/ormin_sqlite.nim(79, 11) Error: usage of 'isNil' is a user-defined error
# example.nim
import htmlgen
import jester
import ormin
import nwt
import db_sqlite
var templates = newNwt("*.html")
importModel(DbBackend.sqlite, "site_model")
var db {.global.} = open("stuff", "", "", "")
routes:
get "/":
resp h1("Hello world")
get "/add":
query:
insert feeds(feedurl="google.com")
resp templates.renderTemplate("index.html")
```
Latest commit fixed, but there are some new errors:
main.nim(10, 12) template/generic instantiation from here
/home/tay/.nimble/pkgs/ormin-0.1.0/ormin/queries.nim(208, 13) Warning: escape is deprecated [Deprecated]
main.nim(10, 12) template/generic instantiation from here
/home/tay/.nimble/pkgs/ormin-0.1.0/ormin/queries.nim(210, 13) Warning: escape is deprecated [Deprecated]
main.nim(10, 12) template/generic instantiation from here
/home/tay/.nimble/pkgs/ormin-0.1.0/ormin/queries.nim(517, 32) template/generic instantiation from here
/home/tay/.nimble/pkgs/ormin-0.1.0/ormin/queries.nim(496, 50) Error: type mismatch: got <proc (e: varargs[untyped]): untyped{.noSideEffect, gcsafe, locks: <unknown>.}>
but expected one of:
proc name(someProc: NimNode): NimNode
How to reproduce?
This got really weird. The bug is only reproducible when htmlgen is imported? Here's the minimum code to reproduce
import ormin
import htmlgen
importModel(DbBackend.sqlite, "site_model")
var db {.global.} = open("stuff", "", "", "")
site_model.sql is as follows:
CREATE TABLE IF NOT EXISTS feeds (
id INTEGER PRIMARY KEY,
feed_url text NOT NULL
);
compiled with nim c -r main.nim
with nim 0.18.1 install from choosenim's devel branch on Fedora 28.
Getting rid of the import htmlgen
line fixes this which is the really weird part
Read the documentation, import htmlgen
is wrong, it's from htmlgen import nil
or some other more specific import.
Thank you, my apologies!