function typesThatCouldChange()

in src/js/other-websites/fathom.js [2365:2392]


            function typesThatCouldChange() {
                const ret = new NiceSet();

                // Get types that could change:
                const emissions = self.rhs.possibleEmissions();
                if (emissions.couldChangeType) {
                    // Get the possible guaranteed combinations of types on the LHS
                    // (taking just this LHS into account). For each combo, if the RHS
                    // adds a type that's not in the combo, the types in the combo get
                    // unioned into ret.
                    for (let combo of self.lhs.possibleTypeCombinations()) {
                        for (let rhsType of emissions.possibleTypes) {
                            if (!combo.has(rhsType)) {
                                ret.extend(combo);
                                break;
                            }
                        }
                    }
                }
                // Optimization: the possible combos could be later expanded to be
                // informed by earlier rules which add the types mentioned in the LHS.
                // If the only way for something to get B is to have Q first, then we
                // can add Q to each combo and end up with fewer types finalized. Would
                // this imply the existence of a Q->B->Q cycle and thus be impossible?
                // Think about it. If we do this, we can centralize that logic here,
                // rather than repeating it in all the Lhs subclasses).
                return ret;
            }