Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc issues #6

Open
1 task
timotheecour opened this issue Apr 11, 2019 · 64 comments · Fixed by nim-lang/Nim#13892
Open
1 task

misc issues #6

timotheecour opened this issue Apr 11, 2019 · 64 comments · Fixed by nim-lang/Nim#13892

Comments

@timotheecour
Copy link
Owner

timotheecour commented Apr 11, 2019

  • registerSignalHandler uses signal instead of recommended sigation
@timotheecour
Copy link
Owner Author

  • document that writeFile follows symlinks

@timotheecour
Copy link
Owner Author

-d:release:off doesn't unset -d:release ; WORKAROUND: use -u:release

@timotheecour
Copy link
Owner Author

timotheecour commented Mar 12, 2020

EDIT: fixed in nim-lang#13642 (via checkDir option)

@timotheecour
Copy link
Owner Author

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??

@timotheecour
Copy link
Owner Author

timotheecour commented Mar 13, 2020

  • nimscript:
    exception handling doesn't support 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

@timotheecour
Copy link
Owner Author

adding --passc:-flto does not recompile C sources; need -f workaround

@timotheecour
Copy link
Owner Author

timotheecour commented Mar 24, 2020

@timotheecour
Copy link
Owner Author

  • maybe we should add a timeout for individual tests to avoid problems like this in future (rest of tests will run ; at least we'll know which test(s) timeout instead of just travis timing out w no diagnostic info)

@timotheecour
Copy link
Owner Author

timotheecour commented Mar 26, 2020

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)

@timotheecour
Copy link
Owner Author

#    /* 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 ]

@timotheecour
Copy link
Owner Author

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)

@timotheecour
Copy link
Owner Author

@timotheecour
Copy link
Owner Author

track Documentation async by juancarlospaco · Pull Request #12979 · nim-lang/Nim : Documentation async by juancarlospaco · Pull Request #12979 · nim-lang/Nim

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?

@timotheecour timotheecour changed the title miscellaneous issues misc issues Mar 31, 2020
@timotheecour
Copy link
Owner Author

timotheecour commented Mar 31, 2020

``
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

* remove 'gc:none' and 'refc' without 'd:useRealtimeGC' from gc tests

@timotheecour
Copy link
Owner Author

csources not being tested anymore

csources are now archived, no need to run kochExecFold("C sources", "csource") anymore

nim-lang#13803 (comment)

@timotheecour
Copy link
Owner Author

  • D20200331T022512 features need to be localizable in VM (just like in non vm code)
    eg: this should work
{.push experimental: Foo.}
bar()
{.pop.}

@timotheecour
Copy link
Owner Author

deprecate isNil(a: IntSet) since IntSet is an object; maybe use same treatment as isNil for string etc (user defined error)

@timotheecour
Copy link
Owner Author

timotheecour commented Mar 31, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 1, 2020

  • defined(macos) is often wrong eg shd be defined(osx)
    eg: openDefaultBrowser fails on OSX

also, check whether nim-lang#13818 is desirable on osx, or whether it prevents useful case of just opening browser

pending nim-lang#13892

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 1, 2020

@timotheecour
Copy link
Owner Author

nim-lang#13809 (comment)

what about tools/dochack which includes tools/dochack/dochack.nim?

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 1, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 1, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 2, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 2, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 2, 2020

@timotheecour
Copy link
Owner Author

  • {.push ignoreNotNil.} to allow ignoring not nil in a scope, eg for seq.setLen

@timotheecour
Copy link
Owner Author

--hints:off --hint:cc should work

@timotheecour
Copy link
Owner Author

nkNilLit shd be in nkLiterals

@timotheecour
Copy link
Owner Author

callDepthLimitReached should raise StackOverflowError (currently unused)

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 9, 2020

fmt:
fmt"foo{b["title"]}bar"
Error: could not parse b[.

@timotheecour
Copy link
Owner Author

adding --hint:cc:on should imply -f but doesnt'

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 10, 2020

I also added a new define (-d:noOpenSSLHacks)

should be -d:nimNoOpenSSLHacks to avoid name clashes

@timotheecour
Copy link
Owner Author

status-im/nim-stint#103 (comment)
(fix for status-im/nim-stint#103 bundled in pr_misc)

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 11, 2020

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 nim-lang#13953
(ie, tell whether ccodegen is correct wrt duplicate static assert checks)

@timotheecour
Copy link
Owner Author

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

@timotheecour
Copy link
Owner Author

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

@timotheecour
Copy link
Owner Author

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

@timotheecour
Copy link
Owner Author

Error: VM does not support 'cast' from tyPointer to tyCString

@timotheecour
Copy link
Owner Author

unlike 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

@timotheecour
Copy link
Owner Author

  • remove unused NimCompilerApiVersion but how come there r no unused warning? does it not work for const?

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 26, 2020

SomeOrdinal should include char, and SomeOrdinal vs Ordinal doc should improve

@timotheecour
Copy link
Owner Author

in an include file imported from several places, we probably should not generate XDeclaredButNotUsed

/Users/timothee/git_clone/nim/Nim_prs/lib/system/inclrtl.nim(54, 10) Hint: 'isSince' is declared but not used [XDeclaredButNotUsed]

@timotheecour
Copy link
Owner Author

timotheecour commented May 7, 2020

@timotheecour
Copy link
Owner Author

timotheecour commented May 11, 2020

  • check whether nim c -b:cpp main works

@timotheecour
Copy link
Owner Author

changelog nim-lang#14278

@timotheecour
Copy link
Owner Author

timotheecour commented May 17, 2020

@timotheecour
Copy link
Owner Author

nim-lang#12293 (comment)

  • findNimStdLib will not work with choosenim-installed nim; this is in part due to choosenim shims (use symlinks instead of shims where symlinks are supported dom96/choosenim#189); it could use nim dump --dump.format:json at runtime
  • nimble install compiler is misleading and this seems like a bug:
    it installs under:
    /Users/timothee/.nimble/pkgs/compiler-1.3.5/compiler.nimble
    yet uses the latest release tag, 1.2, so the 1.3.5 is really misleading

@timotheecour
Copy link
Owner Author

--parallelBuild:1 disables hintCC

@timotheecour
Copy link
Owner Author

timotheecour commented May 25, 2020

  • SomePointer should include cstring in options.nim

see pr_typetraits_somePointer D20210223T123714
blocked by nim-lang#16026

@timotheecour
Copy link
Owner Author

create a bugreport for other root cause of nim-lang#14404 see nim-lang#14413 (comment)

@timotheecour
Copy link
Owner Author

unittest

  template asgn(a: untyped, value: typed) =
    var a = value # XXX: we need "var: var" here in order to
                  # preserve the semantics of var params

@timotheecour
Copy link
Owner Author

backport trailing else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant