303303
304304# A simplified type_more_complex query over the extended lattice
305305# (assumes typeb ⊑ typea)
306- function issimplertype (𝕃:: AbstractLattice , @nospecialize (typea), @nospecialize (typeb))
306+ @noinfer function issimplertype (𝕃:: AbstractLattice , @nospecialize (typea), @nospecialize (typeb))
307307 typea isa MaybeUndef && (typea = typea. typ) # n.b. does not appear in inference
308308 typeb isa MaybeUndef && (typeb = typeb. typ) # n.b. does not appear in inference
309309 @assert ! isa (typea, LimitedAccuracy) && ! isa (typeb, LimitedAccuracy) " LimitedAccuracy not supported by simplertype lattice" # n.b. the caller was supposed to handle these
@@ -413,7 +413,7 @@ function merge_causes(causesa::IdSet{InferenceState}, causesb::IdSet{InferenceSt
413413 end
414414end
415415
416- @noinline function tmerge_limited (lattice:: InferenceLattice , @nospecialize (typea), @nospecialize (typeb))
416+ @noinfer @ noinline function tmerge_limited (lattice:: InferenceLattice , @nospecialize (typea), @nospecialize (typeb))
417417 typea === Union{} && return typeb
418418 typeb === Union{} && return typea
419419
464464 return LimitedAccuracy (tmerge (widenlattice (lattice), typea, typeb), causes)
465465end
466466
467- function tmerge (lattice:: InferenceLattice , @nospecialize (typea), @nospecialize (typeb))
467+ @noinfer function tmerge (lattice:: InferenceLattice , @nospecialize (typea), @nospecialize (typeb))
468468 if isa (typea, LimitedAccuracy) || isa (typeb, LimitedAccuracy)
469469 return tmerge_limited (lattice, typea, typeb)
470470 end
@@ -474,7 +474,7 @@ function tmerge(lattice::InferenceLattice, @nospecialize(typea), @nospecialize(t
474474 return tmerge (widenlattice (lattice), typea, typeb)
475475end
476476
477- function tmerge (lattice:: ConditionalsLattice , @nospecialize (typea), @nospecialize (typeb))
477+ @noinfer function tmerge (lattice:: ConditionalsLattice , @nospecialize (typea), @nospecialize (typeb))
478478 # type-lattice for Conditional wrapper (NOTE never be merged with InterConditional)
479479 if isa (typea, Conditional) && isa (typeb, Const)
480480 if typeb. val === true
@@ -509,7 +509,7 @@ function tmerge(lattice::ConditionalsLattice, @nospecialize(typea), @nospecializ
509509 return tmerge (widenlattice (lattice), typea, typeb)
510510end
511511
512- function tmerge (lattice:: InterConditionalsLattice , @nospecialize (typea), @nospecialize (typeb))
512+ @noinfer function tmerge (lattice:: InterConditionalsLattice , @nospecialize (typea), @nospecialize (typeb))
513513 # type-lattice for InterConditional wrapper (NOTE never be merged with Conditional)
514514 if isa (typea, InterConditional) && isa (typeb, Const)
515515 if typeb. val === true
@@ -544,15 +544,15 @@ function tmerge(lattice::InterConditionalsLattice, @nospecialize(typea), @nospec
544544 return tmerge (widenlattice (lattice), typea, typeb)
545545end
546546
547- function tmerge (𝕃:: AnyMustAliasesLattice , @nospecialize (typea), @nospecialize (typeb))
547+ @noinfer function tmerge (𝕃:: AnyMustAliasesLattice , @nospecialize (typea), @nospecialize (typeb))
548548 typea = widenmustalias (typea)
549549 typeb = widenmustalias (typeb)
550550 return tmerge (widenlattice (𝕃), typea, typeb)
551551end
552552
553553# N.B. This can also be called with both typea::Const and typeb::Const to
554554# to recover PartialStruct from `Const`s with overlapping fields.
555- function tmerge_partial_struct (lattice:: PartialsLattice , @nospecialize (typea), @nospecialize (typeb))
555+ @noinfer function tmerge_partial_struct (lattice:: PartialsLattice , @nospecialize (typea), @nospecialize (typeb))
556556 aty = widenconst (typea)
557557 bty = widenconst (typeb)
558558 if aty === bty
@@ -610,7 +610,7 @@ function tmerge_partial_struct(lattice::PartialsLattice, @nospecialize(typea), @
610610 return nothing
611611end
612612
613- function tmerge (lattice:: PartialsLattice , @nospecialize (typea), @nospecialize (typeb))
613+ @noinfer function tmerge (lattice:: PartialsLattice , @nospecialize (typea), @nospecialize (typeb))
614614 # type-lattice for Const and PartialStruct wrappers
615615 aps = isa (typea, PartialStruct)
616616 bps = isa (typeb, PartialStruct)
@@ -653,8 +653,7 @@ function tmerge(lattice::PartialsLattice, @nospecialize(typea), @nospecialize(ty
653653 return tmerge (wl, typea, typeb)
654654end
655655
656-
657- function tmerge (lattice:: ConstsLattice , @nospecialize (typea), @nospecialize (typeb))
656+ @noinfer function tmerge (lattice:: ConstsLattice , @nospecialize (typea), @nospecialize (typeb))
658657 acp = isa (typea, Const) || isa (typea, PartialTypeVar)
659658 bcp = isa (typeb, Const) || isa (typeb, PartialTypeVar)
660659 if acp && bcp
@@ -666,7 +665,7 @@ function tmerge(lattice::ConstsLattice, @nospecialize(typea), @nospecialize(type
666665 return tmerge (wl, typea, typeb)
667666end
668667
669- function tmerge (:: JLTypeLattice , @nospecialize (typea:: Type ), @nospecialize (typeb:: Type ))
668+ @noinfer function tmerge (:: JLTypeLattice , @nospecialize (typea:: Type ), @nospecialize (typeb:: Type ))
670669 # it's always ok to form a Union of two concrete types
671670 act = isconcretetype (typea)
672671 bct = isconcretetype (typeb)
@@ -682,7 +681,7 @@ function tmerge(::JLTypeLattice, @nospecialize(typea::Type), @nospecialize(typeb
682681 return tmerge_types_slow (typea, typeb)
683682end
684683
685- @noinline function tmerge_types_slow (@nospecialize (typea:: Type ), @nospecialize (typeb:: Type ))
684+ @noinfer @ noinline function tmerge_types_slow (@nospecialize (typea:: Type ), @nospecialize (typeb:: Type ))
686685 # collect the list of types from past tmerge calls returning Union
687686 # and then reduce over that list
688687 types = Any[]
0 commit comments