Open timotheecour opened 5 years ago
writeFile
follows symlinks-d:release:off
doesn't unset -d:release
; WORKAROUND: use -u:release
EDIT: fixed in https://github.com/nim-lang/Nim/pull/13642 (via checkDir option)
proc toDll*(filename: string): string =
## On Windows adds ".dll" to `filename`, on Posix produces "lib$filename.so".
(when defined(windows): filename & ".dll" else: "lib" & filename & ".so")
=> OSX??
Exception as e
try: foo
except Exception as e: bar
``
nor getCurrentException, nor getCurrentExceptionMsg
Edited:
Itt works now
nim e --eval:"try: echo 1 except Exception as e: echo 2"
prints: 1
adding --passc:-flto
does not recompile C sources; need -f
workaround
line tracing doesn't help here:
--embedsrc
--linetrace:on
--linedir
nimb cpp -r -f -d:case1 --stacktrace:on --passc:-D=NIM_ENABLE_BACKEND_WARNING --passC:'-Wwrite-strings -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-pointer-types-discards-qualifiers -Wno-writable-strings -Wno-invalid-offsetof' --embedsrc --hint:cc:on --linetrace:on --linedir compiler/btrees.nim
#line 159 "/Users/timothee/git_clone/nim/Nim_prs/compiler/btrees.nim"
unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp_)); unsureAsgnRef((void**) (&(*Result).Field1), copyString(colontmp__2)); (*Result).Field2 = colontmp__3; popFrame();}
static N_NIMCALL(void, Marker_tyRef__IL7aN7O9aNru9bTSC89c5Ikqw)(void* p, NI op) {
tyObject_NodecolonObjectType___N9cnVBw3Vb4RjTWgNwB6wqw* a;
NI T1_; NI T2_; NI T3_; a = (tyObject_NodecolonObjectType___N9cnVBw3Vb4RjTWgNwB6wqw*)p;
T1_ = (NI)0; switch ((*a).isInternal) {
case NIM_FALSE:
T2_ = (NI)0; for (T2_ = 0; T2_ < 512; T2_++) { nimGCvisit((void*)(*a)._isInternal_1.vals[T2_], op); }
break;
case NIM_TRUE:
T3_ = (NI)0; for (T3_ = 0; T3_ < 512; T3_++) { nimGCvisit((void*)(*a)._isInternal_2.links[T3_], op); }
break;
}
}
for this code:
proc next*[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int) =
var it = b.root
var i = index
# navigate to the right leaf:
while it.isInternal:
var sum = 0
for k in 0..<it.entries:
let c = countSubTree(it.links[k])
inc sum, c
if sum > i:
it = it.links[k]
dec i, (sum - c)
break
result = (it.keys[i], it.vals[i], index+1)
# /* consider using NULL if comment below for NIM_NIL doesn't apply to C++ */
# define NIM_NIL 0
indeed https://stackoverflow.com/a/50766105/1426932 [ Note: In particular, neither the null pointer conversion for a zero-valued integral constant expression ([conv.ptr]) nor the derived-to-base conversion ([conv.ptr]) are applied. Although 0 is a valid template-argument for a non-type template-parameter of integral type, it is not a valid template-argument for a non-type template-parameter of pointer type. However, both (int*)0 and nullptr are valid template-arguments for a non-type template-parameter of type “pointer to int.” — end note ]
wrong error message in sigmatch:
should show int
instead of range 0..512(int)
proc bar(a: csize_t) = discard
proc fun[R](a: array[R, char]) =
const N = high(a)
static: doAssert N is int
bar(N)
var a: array[0..512, char]
fun(a)
Error: type mismatch: got <range 0..512(int)>
but expected one of:
proc bar(a: csize_t)
first type mismatch at position: 1
required type for a: csize_t
but expression 'N' is of type: range 0..512(int)
expression: bar(N)
bar(N)
freebsd BUG getApplFreebsd
So, if we all agree on that, can we close this PR and use its content as a basis for doc/tut4.rst, which will be async tutorial?
track:
isSsd
https://github.com/nim-lang/Nim/pull/13533track https://github.com/nim-lang/Nim/pull/13803#issuecomment-606354919 Faster CIs
check https://github.com/nim-lang/Nim/pull/13803/files re-instigate this test: https://github.com/nim-lang/Nim/pull/13803/commits/a60cc28239161883d28491f401ae584b545b6c0c tindexerrorformatbounds and merge it to tests/trunner
``
when defined(posix):
kochExecFold("Docs", "docs --git.commit:devel")
kochExecFold("C sources", "csource")
elif defined(windows):
when false:
kochExec "csource"
kochExec "zip"
maybe we need: nim runExamples main.nim
we don't bootstrap without -d:release anymore (-d:release is not as dangerous as before, we have -d:danger now); csources are now archived, no need to run kochExecFold("C sources", "csource") anymore
=> but doesn't mean we shouldn't test the code that runs csource, that code could regress; we ARE gonna need to rebuild csources at some point even if csources is frozen, to avoid keeping having to bootstrap from a really old compiler (so we can simplify nim code)
added Github workflow for checking if the documentation is still correct, no need to run kochExecFold("Docs", "docs --git.commit:devel") anymore on every PR
=> but now, nim doc
only run from ubuntu; sometimes, these are our only tests
csources not being tested anymore
csources are now archived, no need to run kochExecFold("C sources", "csource") anymore
https://github.com/nim-lang/Nim/pull/13803#issuecomment-606354919
{.push experimental: Foo.}
bar()
{.pop.}
deprecate isNil(a: IntSet)
since IntSet is an object; maybe use same treatment as isNil for string etc (user defined error)
Edited: null safe make some progresses now https://nim-lang.github.io/Nim/manual_experimental_strictnotnil.html
defined(macos)
is often wrong eg shd be defined(osx)
eg: openDefaultBrowser
fails on OSXalso, check whether https://github.com/nim-lang/Nim/pull/13818 is desirable on osx, or whether it prevents useful case of just opening browser
https://github.com/nim-lang/Nim/pull/13809#discussion_r401287070
what about tools/dochack which includes tools/dochack/dochack.nim?
nim doc
for compiler sources (see https://github.com/nim-lang/Nim/pull/13221) after some of the stuff was undone; note: requires also checking that the new github actions triggers on those sources too{.push ignoreNotNil.}
to allow ignoring not nil
in a scope, eg for seq.setLen
using this:
nimbase.h should be tracked as a depdendency in the main.json file generated by --genscript and maybe also the generated main.deps file
D20200405T131708 macro pragma not overloadable
macro bar(body): untyped =
body
template bar(a: int, b: string): untyped =
discard
proc fun(a: int) {.bar.} =
discard
and errmsg is bad: Error: redefinition of 'fun'; previous declaration here: /Users/timothee/git_clone/nim/timn/tests/nim/all/t10503.nim(11, 6) proc fun(a: int) {.bar.} = ^
show resolved types in errmsgs instead of useless:
but expected one of:
proc contains[T](x: set[T]; y: T): bool
first type mismatch at position: 2
required type for y: T
but expression 'sfVarPragma' is of type: TSymFlag
6 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
expression: contains(symi.flags, sfVarPragma)
if sfVarPragma in symi.flags:
check this: # xxx: also check for nkRefTy as in opcLdDeref?
see https://github.com/nim-lang/Nim/pull/13865/files#diff-df1f02d5585eaaa687dd520ca30be3faR801
add test case from https://github.com/timotheecour/vitanim/blob/master/testcases/tests/test_vm_var_importc.nim left over from VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer by timotheecour · Pull Request #12877 · nim-lang/Nim : VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer by timotheecour · Pull Request #12877 · nim-lang/Nim
rebuild logic should check nimbase.h (at least)
check whether noinit in some parts of stdlib suffer from this: https://github.com/dlang/phobos/pull/6178#discussion_r178309551
var a {.noinit.}: seq[Foo]
a.setLenUninitialized(n)
fillUp(a)
if fillUp
throws before a
was filled up, you may get garbage references that would never be released, causing memory leaks?
which GC's could that affect?
see whether suggestion proposed in that link works
--hints:off --hint:cc
should work
nkNilLit shd be in nkLiterals
callDepthLimitReached should raise StackOverflowError (currently unused)
fmt:
fmt"foo{b["title"]}bar"
Error: could not parse b[
.
adding --hint:cc:on
should imply -f
but doesnt'
I also added a new define (-d:noOpenSSLHacks)
should be -d:nimNoOpenSSLHacks to avoid name clashes
fix this:
adding entries should not yield duplicate ABI checks, as enforced by
typeABICache
. Currently the test doesn't check for this but you can inspect the cgen'd file
in https://github.com/nim-lang/Nim/pull/13926/files
using c_currentSourcePath
from https://github.com/nim-lang/Nim/pull/13953
(ie, tell whether ccodegen is correct wrt duplicate static assert checks)
lhmbp $nim_prs_D br:pr_fix_tnim_88_SIGSEGV_VM $ $(d_nim_bin).ffi.1 cpp --passC:-std=c++11 -d:timn_D20191207T181719 --app:lib -o:/tmp/libD20191211T004436.dylib $vitanim_D/testcases/tests/test_vm_var_importc_imp.nim
regression test case from test_vm_var_importc_imp.nim should be added to testament, see VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer by timotheecour · Pull Request #12877 · nim-lang/Nim : VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer by timotheecour · Pull Request #12877 · nim-lang/Nim
nim doesn't understand empty (or whitespace only) args in cmd line:
nim c --foo.bar.baz:' ' $timn_D/tests/nim/all/t10552.nim
command line(1, 2) Error: command expects a filename
C:\Users\timothee\git_clone\Nim>bin\nim_temp1.exe c --cc:vcc --warning:backendwarning:off -f --hint:conf:off tests/misc/mbackendwarnings.nim
=> nimbase.h(522): error C2118: negative subscript
fails ABI test on windows
Error: VM does not support 'cast' from tyPointer to tyCString
var a: MyEnumWithOffset
, eg for DateTime.month, see https://github.com/nim-lang/Nim/pull/14002#issuecomment-615195005 and https://github.com/nim-lang/Nim/pull/14002/files#r410529632unlike range[1..31], it's currently legal in Nim and doesn't give any warnings; if it becomes illegal or deprecated, this can be changed
registerSignalHandler
uses signal instead of recommended sigation