Tagged CHOICEs must be explicit if the default is implicit, automatic or empty.
authorJames Ward <j.ward@acfr.usyd.edu.au>
Mon, 5 Oct 2015 23:28:22 +0000 (10:28 +1100)
committerJames Ward <j.ward@acfr.usyd.edu.au>
Wed, 7 Oct 2015 23:38:04 +0000 (10:38 +1100)
Resolves issue #23.

asn1ate/sema.py

index 9c7b118..7aac446 100644 (file)
@@ -300,12 +300,16 @@ class Module(SemaNode):
         """ The implicity for a tag depends on three things:
         * Any written implicity on the tag decl itself (``tag_implicity``)
         * The module's tag default (kept in ``self.tag_default``)
-        * Details of the tagged type according to X.680, 30.6c (not implemented,
-          but should be doable based on ``tagged_type_decl``)
+        * Details of the tagged type according to X.680, 30.6c (``tagged_type_decl``)
         """
         if tag_implicity is not None:
             return tag_implicity
 
+        # Tagged CHOICEs must always be explicit if the default is implicit, automatic or empty
+        # See X.680, 30.6c
+        if isinstance(tagged_type_decl, ChoiceType):
+            return TagImplicity.EXPLICIT
+
         # No tag implicity specified, use module-default
         if self.tag_default is None:
             # Explicit is default if nothing