…lines 1–121 unchanged (121 lines)
122 return false;
123 }
124 }
125
126 boolean thisIsVarArgs = thisParam.isVarArgs();
127 boolean thatIsVarArgs = thatParam.isVarArgs();
128 boolean thisIsOptional = thisIsVarArgs || thisParam.isOptionalArg();
129 boolean thatIsOptional = thatIsVarArgs || thatParam.isOptionalArg();
130
131 // "that" can't be a supertype, because it's missing a required argument.
132 if (!thisIsOptional && thatIsOptional) {
133 // NOTE(nicksantos): In our type system, we use {function(...?)} and
134 // {function(...NoType)} to to indicate that arity should not be
135 // checked. Strictly speaking, this is not a correct formulation,
136 // because now a sub-function can required arguments that are var_args
137 // in the super-function. So we special-case this.
138 boolean isTopFunction =
139 thatIsVarArgs &&
140 (thatParamType == null ||
141 thatParamType.isUnknownType() ||
142 thatParamType.isNoType());
143 if (!isTopFunction) {
144 return false;
145 }
146 }
147
148 // don't advance if we have variable arguments
149 if (!thisIsVarArgs) {
150 thisParam = thisParam.getNext();
151 }
152 if (!thatIsVarArgs) {
…lines 153–157 unchanged (5 lines)
158 thisParam = null;
159 thatParam = null;
160 }
161 }
162
163 // "that" can't be a supertype, because it's missing a required arguement.
164 if (thisParam != null
165 && !thisParam.isOptionalArg() && !thisParam.isVarArgs()
166 && thatParam == null) {
167 return false;
168 }
169
170 return true;
171 }
172
173 /**
174 * @return True if our parameter spec is equal to {@code that}'s parameter
…lines 175–292 unchanged (118 lines)