@@ -161,23 +161,23 @@ If `π` is `JLTypeLattice`, this is equivalent to subtyping.
161161"""
162162function β end
163163
164- β (:: JLTypeLattice , @nospecialize (a:: Type ), @nospecialize (b:: Type )) = a <: b
164+ @noinfer β (:: JLTypeLattice , @nospecialize (a:: Type ), @nospecialize (b:: Type )) = a <: b
165165
166166"""
167167 β(π::AbstractLattice, a, b) -> Bool
168168
169169The strict partial order over the type inference lattice.
170170This is defined as the irreflexive kernel of `β`.
171171"""
172- β (π:: AbstractLattice , @nospecialize (a), @nospecialize (b)) = β (π, a, b) && ! β (π, b, a)
172+ @noinfer β (π:: AbstractLattice , @nospecialize (a), @nospecialize (b)) = β (π, a, b) && ! β (π, b, a)
173173
174174"""
175175 β€(π::AbstractLattice, a, b) -> Bool
176176
177177This order could be used as a slightly more efficient version of the strict order `β`,
178178where we can safely assume `a β b` holds.
179179"""
180- β€ (π:: AbstractLattice , @nospecialize (a), @nospecialize (b)) = ! β (π, b, a)
180+ @noinfer β€ (π:: AbstractLattice , @nospecialize (a), @nospecialize (b)) = ! β (π, b, a)
181181
182182"""
183183 is_lattice_equal(π::AbstractLattice, a, b) -> Bool
@@ -186,7 +186,7 @@ Check if two lattice elements are partial order equivalent.
186186This is basically `a β b && b β a` in the lattice of `π`
187187but (optionally) with extra performance optimizations.
188188"""
189- function is_lattice_equal (π:: AbstractLattice , @nospecialize (a), @nospecialize (b))
189+ @noinfer function is_lattice_equal (π:: AbstractLattice , @nospecialize (a), @nospecialize (b))
190190 a === b && return true
191191 return β (π, a, b) && β (π, b, a)
192192end
@@ -197,32 +197,32 @@ end
197197Determines whether the given lattice element `t` of `π` has non-trivial extended lattice
198198information that would not be available from the type itself.
199199"""
200- has_nontrivial_extended_info (π:: AbstractLattice , @nospecialize t) =
200+ @noinfer has_nontrivial_extended_info (π:: AbstractLattice , @nospecialize t) =
201201 has_nontrivial_extended_info (widenlattice (π), t)
202- function has_nontrivial_extended_info (π:: PartialsLattice , @nospecialize t)
202+ @noinfer function has_nontrivial_extended_info (π:: PartialsLattice , @nospecialize t)
203203 isa (t, PartialStruct) && return true
204204 isa (t, PartialOpaque) && return true
205205 return has_nontrivial_extended_info (widenlattice (π), t)
206206end
207- function has_nontrivial_extended_info (π:: ConstsLattice , @nospecialize t)
207+ @noinfer function has_nontrivial_extended_info (π:: ConstsLattice , @nospecialize t)
208208 isa (t, PartialTypeVar) && return true
209209 if isa (t, Const)
210210 val = t. val
211211 return ! issingletontype (typeof (val)) && ! (isa (val, Type) && hasuniquerep (val))
212212 end
213213 return has_nontrivial_extended_info (widenlattice (π), t)
214214end
215- has_nontrivial_extended_info (:: JLTypeLattice , @nospecialize (t)) = false
215+ @noinfer has_nontrivial_extended_info (:: JLTypeLattice , @nospecialize (t)) = false
216216
217217"""
218218 is_const_prop_profitable_arg(π::AbstractLattice, t) -> Bool
219219
220220Determines whether the given lattice element `t` of `π` has new extended lattice information
221221that should be forwarded along with constant propagation.
222222"""
223- is_const_prop_profitable_arg (π:: AbstractLattice , @nospecialize t) =
223+ @noinfer is_const_prop_profitable_arg (π:: AbstractLattice , @nospecialize t) =
224224 is_const_prop_profitable_arg (widenlattice (π), t)
225- function is_const_prop_profitable_arg (π:: PartialsLattice , @nospecialize t)
225+ @noinfer function is_const_prop_profitable_arg (π:: PartialsLattice , @nospecialize t)
226226 if isa (t, PartialStruct)
227227 return true # might be a bit aggressive, may want to enable some check like follows:
228228 # for i = 1:length(t.fields)
@@ -236,7 +236,7 @@ function is_const_prop_profitable_arg(π::PartialsLattice, @nospecialize t)
236236 isa (t, PartialOpaque) && return true
237237 return is_const_prop_profitable_arg (widenlattice (π), t)
238238end
239- function is_const_prop_profitable_arg (π:: ConstsLattice , @nospecialize t)
239+ @noinfer function is_const_prop_profitable_arg (π:: ConstsLattice , @nospecialize t)
240240 if isa (t, Const)
241241 # don't consider mutable values useful constants
242242 val = t. val
@@ -245,24 +245,24 @@ function is_const_prop_profitable_arg(π::ConstsLattice, @nospecialize t)
245245 isa (t, PartialTypeVar) && return false # this isn't forwardable
246246 return is_const_prop_profitable_arg (widenlattice (π), t)
247247end
248- is_const_prop_profitable_arg (:: JLTypeLattice , @nospecialize t) = false
248+ @noinfer is_const_prop_profitable_arg (:: JLTypeLattice , @nospecialize t) = false
249249
250- is_forwardable_argtype (π:: AbstractLattice , @nospecialize (x)) =
250+ @noinfer is_forwardable_argtype (π:: AbstractLattice , @nospecialize (x)) =
251251 is_forwardable_argtype (widenlattice (π), x)
252- function is_forwardable_argtype (π:: ConditionalsLattice , @nospecialize x)
252+ @noinfer function is_forwardable_argtype (π:: ConditionalsLattice , @nospecialize x)
253253 isa (x, Conditional) && return true
254254 return is_forwardable_argtype (widenlattice (π), x)
255255end
256- function is_forwardable_argtype (π:: PartialsLattice , @nospecialize x)
256+ @noinfer function is_forwardable_argtype (π:: PartialsLattice , @nospecialize x)
257257 isa (x, PartialStruct) && return true
258258 isa (x, PartialOpaque) && return true
259259 return is_forwardable_argtype (widenlattice (π), x)
260260end
261- function is_forwardable_argtype (π:: ConstsLattice , @nospecialize x)
261+ @noinfer function is_forwardable_argtype (π:: ConstsLattice , @nospecialize x)
262262 isa (x, Const) && return true
263263 return is_forwardable_argtype (widenlattice (π), x)
264264end
265- function is_forwardable_argtype (:: JLTypeLattice , @nospecialize x)
265+ @noinfer function is_forwardable_argtype (:: JLTypeLattice , @nospecialize x)
266266 return false
267267end
268268
@@ -281,9 +281,9 @@ External lattice `πα΅’::ExternalLattice` may overload:
281281"""
282282function widenreturn end , function widenreturn_noslotwrapper end
283283
284- is_valid_lattice (π:: AbstractLattice , @nospecialize (elem)) =
284+ @noinfer is_valid_lattice (π:: AbstractLattice , @nospecialize (elem)) =
285285 is_valid_lattice_norec (π, elem) && is_valid_lattice (widenlattice (π), elem)
286- is_valid_lattice (π:: JLTypeLattice , @nospecialize (elem)) = is_valid_lattice_norec (π, elem)
286+ @noinfer is_valid_lattice (π:: JLTypeLattice , @nospecialize (elem)) = is_valid_lattice_norec (π, elem)
287287
288288has_conditional (π:: AbstractLattice ) = has_conditional (widenlattice (π))
289289has_conditional (:: AnyConditionalsLattice ) = true
@@ -306,12 +306,12 @@ has_extended_unionsplit(::JLTypeLattice) = false
306306const fallback_lattice = InferenceLattice (BaseInferenceLattice. instance)
307307const fallback_ipo_lattice = InferenceLattice (IPOResultLattice. instance)
308308
309- β ( @ nospecialize (a), @nospecialize (b) ) = β (fallback_lattice, a, b)
310- tmeet ( @ nospecialize (a), @nospecialize (b)) = tmeet (fallback_lattice, a, b)
311- tmerge ( @ nospecialize (a), @nospecialize (b)) = tmerge (fallback_lattice, a, b)
312- β (@nospecialize (a), @nospecialize (b)) = β (fallback_lattice, a, b)
313- β€ (@nospecialize (a), @nospecialize (b)) = β€ (fallback_lattice, a, b)
314- is_lattice_equal (@nospecialize (a), @nospecialize (b)) = is_lattice_equal (fallback_lattice, a, b)
309+ @noinfer @ nospecialize (a) β @nospecialize (b) = β (fallback_lattice, a, b)
310+ @noinfer @ nospecialize (a) β @nospecialize (b) = β (fallback_lattice, a, b)
311+ @noinfer @ nospecialize (a) β€ @nospecialize (b) = β€ (fallback_lattice, a, b)
312+ @noinfer tmeet (@nospecialize (a), @nospecialize (b)) = tmeet (fallback_lattice, a, b)
313+ @noinfer tmerge (@nospecialize (a), @nospecialize (b)) = tmerge (fallback_lattice, a, b)
314+ @noinfer is_lattice_equal (@nospecialize (a), @nospecialize (b)) = is_lattice_equal (fallback_lattice, a, b)
315315
316316# Widenlattice with argument
317317widenlattice (:: JLTypeLattice , @nospecialize (t)) = widenconst (t)
0 commit comments