-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of standalone .cbor and tagged types #112
base: master
Are you sure you want to change the base?
Conversation
fn has_embed<'a>(parent_visitor: &'a ParentVisitor, rule: &Rule<'a>) -> bool { | ||
_has_embed(parent_visitor, &CDDLType::from(rule)) | ||
} | ||
fn _has_embed<'a, 'b>(parent_visitor: &'a ParentVisitor, cddl_type: &CDDLType<'a, 'b>) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't use this name as _ prefixes in rust are to signify they're unused.
@@ -366,7 +375,11 @@ fn parse_type(types: &mut IntermediateTypes, parent_visitor: &ParentVisitor, typ | |||
let base_type = types | |||
.apply_type_aliases(&AliasIdent::new(CDDLIdent::new(ident.to_string()))) | |||
.expect(&format!("Please move definition for {} above {}", type_name, ident)); | |||
types.register_type_alias(type_name.clone(), RustType::Tagged(tag_unwrap, Box::new(base_type)), true, true); | |||
if has_embed(parent_visitor, get_rule(parent_visitor, &CDDLType::from(&inner_type.type1.type2))) { | |||
types.register_type_alias(type_name.clone(), RustType::Tagged(tag_unwrap, Box::new(base_type)), false, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need a minor change for conflict with #111
|| self.rust_structs.contains_key(ident) | ||
|| self.generic_defs.contains_key(ident) | ||
|| self.generic_instances.contains_key(ident) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI the code removed in this file is all unused. It comes from a previous PR that I forgot to delete and it didn't work because has_ident isn't stable across passes of the parsing.rs
The error it fails with is in one of the unit tests. It's treating the test that's:
in the Before we considered that anywhere taking in |
fe6ec0e
to
f78cd04
Compare
TODO: somebody needs to go through and check if this PR is still necessary (other than the commit that deletes unused code) given #117 was merged |
Fix #91
Currently this fails with the following error that I don't really understand