diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-07-23 22:46:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-23 16:46:49 +0200 |
commit | 0db742df7cd20efd030d7b20fe1e523c06325efa (patch) | |
tree | a58570f89a3fb03b0a048849add2cf38943ca73d /nimsuggest | |
parent | 759b8e46be9623ed3f726800d730018e1cea740e (diff) | |
download | Nim-0db742df7cd20efd030d7b20fe1e523c06325efa.tar.gz |
fixes #23867; fixes #23316; rework nimsuggest for ORC (#23879)
fixes #23867 fixes #23316 follow up https://github.com/nim-lang/Nim/pull/22805; fixes https://github.com/nim-lang/Nim/issues/22794 in a different method
Diffstat (limited to 'nimsuggest')
-rw-r--r-- | nimsuggest/nimsuggest.nim | 12 | ||||
-rw-r--r-- | nimsuggest/tests/tchk2.nim | 35 |
2 files changed, 47 insertions, 0 deletions
diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim index ee05f97a0..04bae08c1 100644 --- a/nimsuggest/nimsuggest.nim +++ b/nimsuggest/nimsuggest.nim @@ -231,6 +231,14 @@ proc clearInstCache(graph: ModuleGraph, projectFileIdx: FileIndex) = for id in procIdsToDelete: graph.procInstCache.del id + for tbl in mitems(graph.attachedOps): + var attachedOpsToDelete = newSeq[ItemId]() + for id in tbl.keys: + if id.module == projectFileIdx.int and sfOverridden in resolveAttachedOp(graph, tbl[id]).flags: + attachedOpsToDelete.add id + for id in attachedOpsToDelete: + tbl.del id + proc executeNoHooks(cmd: IdeCmd, file, dirtyfile: AbsoluteFile, line, col: int, tag: string, graph: ModuleGraph) = let conf = graph.config @@ -765,6 +773,10 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = var graph = newModuleGraph(cache, conf) if self.loadConfigsAndProcessCmdLine(cache, conf, graph): + + if conf.selectedGC == gcUnselected and + conf.backend != backendJs: + initOrcDefines(conf) mainCommand(graph) # v3 start diff --git a/nimsuggest/tests/tchk2.nim b/nimsuggest/tests/tchk2.nim new file mode 100644 index 000000000..f5404368d --- /dev/null +++ b/nimsuggest/tests/tchk2.nim @@ -0,0 +1,35 @@ +# bug #22794 +type O = object + +proc `=destroy`(x: O) = discard +proc `=trace`(x: var O; env: pointer) = discard +proc `=copy`(a: var O; b: O) = discard +proc `=dup`(a: O): O {.nodestroy.} = a +proc `=sink`(a: var O; b: O) = discard + + +# bug #23316 +type SomeSturct = object + +proc `=destroy`(x: SomeSturct) = + echo "SomeSturct destroyed" + +# bug #23867 +type ObjStr = object + s: string + +let ostr = ObjStr() # <-- nimsuggest crashes +discard ostr + +type ObjSeq = object + s: seq[int] + +let oseq = ObjSeq() # <-- nimsuggest crashes +discard oseq + +#[!]# +discard """ +$nimsuggest --tester $file +>chk $1 +chk;;skUnknown;;;;Hint;;???;;0;;-1;;">> (toplevel): import(dirty): tests/tchk2.nim [Processing]";;0 +""" |