| 355 | } |
| 356 | |
| 357 | std::optional<std::string> TypeSystem::instantiateClass(Type _instanceVariable, Arity _arity) |
| 358 | { |
| 359 | if (!TypeSystemHelpers{*this}.isTypeConstant(_instanceVariable)) |
| 360 | return "Invalid instance variable."; |
| 361 | auto [typeConstructor, typeArguments] = TypeSystemHelpers{*this}.destTypeConstant(_instanceVariable); |
| 362 | auto& typeConstructorInfo = m_typeConstructors.at(typeConstructor.m_index); |
| 363 | if (_arity.argumentSorts.size() != typeConstructorInfo.arguments()) |
| 364 | return "Invalid arity."; |
| 365 | if (typeArguments.size() != typeConstructorInfo.arguments()) |
| 366 | return "Invalid arity."; |
| 367 | |
| 368 | typeConstructorInfo.arities.emplace_back(_arity); |
| 369 | |
| 370 | return std::nullopt; |
| 371 | } |
no test coverage detected