diff --git a/frontend/include/chpl/framework/ErrorWriter.h b/frontend/include/chpl/framework/ErrorWriter.h index 2c2d567a7b41..2cd7d40b2c22 100644 --- a/frontend/include/chpl/framework/ErrorWriter.h +++ b/frontend/include/chpl/framework/ErrorWriter.h @@ -134,7 +134,7 @@ struct Writer> { template <> struct Writer { void operator()(Context* context, std::ostream& oss, const types::Type* type) { - if (type->isUnknownType()) { + if (!type || type->isUnknownType()) { oss << "unknown type"; } else { stringify str; diff --git a/frontend/lib/resolution/Resolver.cpp b/frontend/lib/resolution/Resolver.cpp index eeeb3403b1d7..241139ce17c4 100644 --- a/frontend/lib/resolution/Resolver.cpp +++ b/frontend/lib/resolution/Resolver.cpp @@ -2208,8 +2208,6 @@ QualifiedType Resolver::typeForId(const ID& id, bool localGenericToUnknown) { } } - CHPL_ASSERT(ct); // or else, pattern not handled yet - if (ct) { auto newDefaultsPolicy = defaultsPolicy; if (defaultsPolicy == DefaultsPolicy::USE_DEFAULTS_OTHER_FIELDS && @@ -2240,7 +2238,7 @@ QualifiedType Resolver::typeForId(const ID& id, bool localGenericToUnknown) { // Otherwise it is a case not handled yet // TODO: handle outer function variables - CHPL_ASSERT(false && "not yet handled"); + CHPL_UNIMPL("not yet handled"); auto unknownType = UnknownType::get(context); return QualifiedType(QualifiedType::UNKNOWN, unknownType); } diff --git a/frontend/lib/resolution/call-init-deinit.cpp b/frontend/lib/resolution/call-init-deinit.cpp index 8ffcaf26d1bd..8e5d2ea3faae 100644 --- a/frontend/lib/resolution/call-init-deinit.cpp +++ b/frontend/lib/resolution/call-init-deinit.cpp @@ -509,6 +509,11 @@ void CallInitDeinit::resolveAssign(const AstNode* ast, const QualifiedType& lhsType, const QualifiedType& rhsType, RV& rv) { + if (lhsType.isUnknown() || lhsType.isErroneousType() || + rhsType.isUnknown() || rhsType.isErroneousType()) { + return; + } + std::vector actuals; actuals.push_back(CallInfoActual(lhsType, UniqueString())); actuals.push_back(CallInfoActual(rhsType, UniqueString())); diff --git a/frontend/lib/resolution/default-functions.cpp b/frontend/lib/resolution/default-functions.cpp index 60e31e743c97..23cc586d8f4d 100644 --- a/frontend/lib/resolution/default-functions.cpp +++ b/frontend/lib/resolution/default-functions.cpp @@ -227,7 +227,8 @@ generateInitSignature(Context* context, const CompositeType* inCompType) { // TODO: generic types if (rf.isGeneric()) { - CHPL_ASSERT(false && "Not handled yet!"); + CHPL_UNIMPL("generating 'init' signatures for generic types is not yet supported"); + return nullptr; } // TODO: super fields and invoking super @@ -745,16 +746,16 @@ getCompilerGeneratedMethodQuery(Context* context, const Type* type, } else if (name == USTR("=")) { result = generateRecordAssignment(context, recordType); } else { - CHPL_ASSERT(false && "record method not implemented yet!"); + CHPL_UNIMPL("record method not implemented yet!"); } } else if (auto cPtrType = type->toCPtrType()) { result = generateCPtrMethod(context, cPtrType, name); } else { - CHPL_ASSERT(false && "should not be reachable"); + CHPL_UNIMPL("should not be reachable"); } } - CHPL_ASSERT(result->untyped()->name() == name); + CHPL_ASSERT(result == nullptr || result->untyped()->name() == name); return QUERY_END(result); } diff --git a/frontend/lib/resolution/resolution-queries.cpp b/frontend/lib/resolution/resolution-queries.cpp index 4482667e8c7f..4d8c838a960b 100644 --- a/frontend/lib/resolution/resolution-queries.cpp +++ b/frontend/lib/resolution/resolution-queries.cpp @@ -3353,7 +3353,6 @@ considerCompilerGeneratedMethods(Context* context, // get the compiler-generated function, may be generic auto tfs = getCompilerGeneratedMethod(context, receiverType, ci.name(), ci.isParenless()); - CHPL_ASSERT(tfs); return tfs; } diff --git a/frontend/lib/util/assertions.cpp b/frontend/lib/util/assertions.cpp index 14305f1ebd31..505900bdc416 100644 --- a/frontend/lib/util/assertions.cpp +++ b/frontend/lib/util/assertions.cpp @@ -67,8 +67,8 @@ void chpl_unimpl(const char* filename, const char* func, int lineno, const char* msg) { std::string fname(filename); auto front = fname.substr(fname.find("frontend"), std::string::npos); - printf("[%s:%d in %s] Unimplemented: %s\n", front.c_str(), lineno, - func, msg); + fprintf(stderr, "[%s:%d in %s] Unimplemented: %s\n", front.c_str(), lineno, + func, msg); };