mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
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
This commit is contained in:
@@ -309,7 +309,7 @@ proc resolveInst(g: ModuleGraph; t: var LazyInstantiation): PInstantiation =
|
||||
t.inst = result
|
||||
assert result != nil
|
||||
|
||||
proc resolveAttachedOp(g: ModuleGraph; t: var LazySym): PSym =
|
||||
proc resolveAttachedOp*(g: ModuleGraph; t: var LazySym): PSym =
|
||||
result = t.sym
|
||||
if result == nil:
|
||||
result = loadSymFromId(g.config, g.cache, g.packed, t.id.module, t.id.packed)
|
||||
@@ -615,7 +615,6 @@ proc markDirty*(g: ModuleGraph; fileIdx: FileIndex) =
|
||||
if m != nil:
|
||||
g.suggestSymbols.del(fileIdx)
|
||||
g.suggestErrors.del(fileIdx)
|
||||
g.resetForBackend
|
||||
incl m.flags, sfDirty
|
||||
|
||||
proc unmarkAllDirty*(g: ModuleGraph) =
|
||||
|
||||
@@ -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
|
||||
|
||||
35
nimsuggest/tests/tchk2.nim
Normal file
35
nimsuggest/tests/tchk2.nim
Normal file
@@ -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
|
||||
"""
|
||||
Reference in New Issue
Block a user