[m-rev.] diff: Fix abort on imported abstract subtype.

Peter Wang novalazy at gmail.com
Mon Apr 12 16:52:18 AEST 2021


compiler/du_type_layout.m:
    Don't abort if we cannot get the base type of an abstract subtype
    (see comment).

diff --git a/compiler/du_type_layout.m b/compiler/du_type_layout.m
index 2e75b94a9..9343ca1c8 100644
--- a/compiler/du_type_layout.m
+++ b/compiler/du_type_layout.m
@@ -723,7 +723,10 @@ add_if_subtype_of_simple_du_type_to_maps(OldTypeTable, TypeCtorTypeDefn,
                 maybe_copy_no_tag_type_from_base(BaseTypeCtor, TypeCtor,
                     TypeParams, no, !NoTagTypeMap)
             else
-                unexpected($pred, "cannot get base type")
+                % This is reachable if there was an error in the module that
+                % defines the imported subtype. The subtype definition would
+                % not have been checked when the interface file is created.
+                true
             )
         ;
             ( AbstractDetails = abstract_type_general
-- 
2.30.0



More information about the reviews mailing list