Skip to content

Commit 0eb6154

Browse files
authored
Merge pull request #266 from mind6/cachefix
detects rare cache corruption issue and allows SymbolServer to recalculate
2 parents d9e75d0 + 1385a84 commit 0eb6154

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/symbols.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ struct DataTypeStore <: SymStore
5050
methods::Vector{MethodStore}
5151
doc::String
5252
exported::Bool
53+
function DataTypeStore(names, super, parameters, types, fieldnames, methods, doc, exported)
54+
if length(types) < length(fieldnames)
55+
error("Only $(length(types)) types were loaded for $(length(fieldnames)) fieldnames. SymbolServer may recalculate the cache.")
56+
end
57+
new(names, super, parameters, types, fieldnames, methods, doc, exported)
58+
end
5359
end
5460

5561
function DataTypeStore(@nospecialize(t), symbol, parent_mod, exported)
@@ -189,10 +195,10 @@ function cache_methods(@nospecialize(f), name, env, get_return_type)
189195
sparams = Core.svec(sparam_syms(m[3])...)
190196
rt = try
191197
@static if isdefined(Core.Compiler, :NativeInterpreter)
192-
Core.Compiler.typeinf_type(Core.Compiler.NativeInterpreter(), m[3], m[3].sig, sparams)
193-
else
194-
Core.Compiler.typeinf_type(m[3], m[3].sig, sparams, Core.Compiler.Params(world))
195-
end
198+
Core.Compiler.typeinf_type(Core.Compiler.NativeInterpreter(), m[3], m[3].sig, sparams)
199+
else
200+
Core.Compiler.typeinf_type(m[3], m[3].sig, sparams, Core.Compiler.Params(world))
201+
end
196202
catch e
197203
Any
198204
end

0 commit comments

Comments
 (0)