fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now parses the whole module at one time (#21379)

* fixes #19795; remove parse pipeline

* isScript

* fixes nimscriptapi

* don't touch reorder

* check script

* fixes tests

* it seems implicit imports of system cause troubles

* access the first child of `nkStmtList`

* ignore comments

* minor messages

* perhaps increases hloLoopDetector

* the module is a stmtList, which changes the errors

* fixes nimdoc

* fixes tlinter

* fixes nim  secret tests

* fixes arc_misc

* fixes nim secret tests again

* safe; fixes one more test

* GlobalError is the root cause too

* fixes parsing errors

* put emit types to the cfsForwardTypes section

* fixes #11852; `{.push checks:off}` now works in procs

* disable navigator

* fixes nimdoc

* add tests for JS

* fixes nimsuggest
This commit is contained in:
ringabout 2023-02-23 03:34:20 +08:00 • committed by GitHub
commit 38f876dd48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 227 additions and 72 deletions

View file

@ -1,9 +1,12 @@
discard """
cmd: "nim check --newruntime --hints:off $file"
nimout: '''
tdont_return_unowned_from_owned.nim(36, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(Obj)' as the return type
tdont_return_unowned_from_owned.nim(39, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(Obj)' as the return type
tdont_return_unowned_from_owned.nim(42, 6) Error: type mismatch: got <Obj>
tdont_return_unowned_from_owned.nim(26, 13) Error: assignment produces a dangling ref: the unowned ref lives longer than the owned ref
tdont_return_unowned_from_owned.nim(27, 13) Error: assignment produces a dangling ref: the unowned ref lives longer than the owned ref
tdont_return_unowned_from_owned.nim(31, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(RootRef)' as the return type
tdont_return_unowned_from_owned.nim(43, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(Obj)' as the return type
tdont_return_unowned_from_owned.nim(46, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(Obj)' as the return type
tdont_return_unowned_from_owned.nim(49, 6) Error: type mismatch: got <Obj>
but expected one of:
proc new[T](a: var ref T; finalizer: proc (x: ref T) {.nimcall.})
first type mismatch at position: 2
@ -11,17 +14,21 @@ proc new[T](a: var ref T; finalizer: proc (x: ref T) {.nimcall.})
2 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
expression: new(result)
tdont_return_unowned_from_owned.nim(42, 6) Error: illformed AST:
tdont_return_unowned_from_owned.nim(50, 13) Error: assignment produces a dangling ref: the unowned ref lives longer than the owned ref
tdont_return_unowned_from_owned.nim(51, 13) Error: assignment produces a dangling ref: the unowned ref lives longer than the owned ref
tdont_return_unowned_from_owned.nim(55, 10) Error: cannot return an owned pointer as an unowned pointer; use 'owned(RootRef)' as the return type
tdont_return_unowned_from_owned.nim(49, 6) Error: illformed AST:
'''
errormsg: "cannot return an owned pointer as an unowned pointer; use 'owned(RootRef)' as the return type"
errormsg: "illformed AST:"
"""
proc testA(result: var (RootRef, RootRef)) =
let r: owned RootRef = RootRef()
result[0] = r
result[1] = RootRef()
proc testB(): RootRef =
let r: owned RootRef = RootRef()
result = r
@ -39,17 +46,11 @@ proc newObjB(): Obj =
result = Obj()
proc newObjC(): Obj =
new(result)
new(result) # illFormedAst raises GlobalError,
# without pipeline parsing, it needs to placed at the end
# in case that it disturbs other errors
let a = newObjA()
let b = newObjB()
let c = newObjC()
proc testA(result: var (RootRef, RootRef)) =
let r: owned RootRef = RootRef()
result[0] = r
result[1] = RootRef()
proc testB(): RootRef =
let r: owned RootRef = RootRef()
result = r