Closed
Conversation
…/idl-types-in-parser
Click to see raw report |
ilbertt
commented
Jun 23, 2025
Contributor
|
Notes from our 1n1/pairing session earlier:
|
christoph-dfinity
suggested changes
Jun 25, 2025
Contributor
christoph-dfinity
left a comment
There was a problem hiding this comment.
Looking very good! Spotted a couple places that might need changes.
…/idl-types-in-parser
ilbertt
commented
Jun 25, 2025
Contributor
Author
There was a problem hiding this comment.
This struct and enum were not used
ilbertt
commented
Jun 26, 2025
Comment on lines
-154
to
-176
| fn check_cycle(env: &TypeEnv) -> Result<()> { | ||
| fn has_cycle<'a>(seen: &mut BTreeSet<&'a str>, env: &'a TypeEnv, t: &'a Type) -> Result<bool> { | ||
| match t.as_ref() { | ||
| TypeInner::Var(id) => { | ||
| if seen.insert(id) { | ||
| let ty = env.find_type(id)?; | ||
| has_cycle(seen, env, ty) | ||
| } else { | ||
| Ok(true) | ||
| } | ||
| } | ||
| _ => Ok(false), | ||
| } | ||
| } | ||
| for (id, ty) in env.0.iter() { | ||
| let mut seen = BTreeSet::new(); | ||
| if has_cycle(&mut seen, env, ty)? { | ||
| return Err(Error::msg(format!("{id} has cyclic type definition"))); | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Moved into a TypeEnv method
lwshang
approved these changes
Jun 30, 2025
ilbertt
commented
Jul 1, 2025
Contributor
Author
There was a problem hiding this comment.
We should not change this code, because if we incur in Future or Unknown, this explodes now.
christoph-dfinity
added a commit
that referenced
this pull request
Jul 8, 2025
**Overview** Adds support for reflecting doc comments from Candid declaration files to the Motoko generated bindings. Internally, it adds the `IDLMergedProg` which is constructed when parsing the Candid declarations and is passed to the Motoko bindings generator. It containts the syntax types along with the associated comments, and it's traversed in parallel with the inner types by the binding generator. Follow-up PRs will add support for doc comments in the other bindings generators. Closes #625. --------- Co-authored-by: ilbertt <luca.bertelli@dfinity.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Refactor the
candid_parserand thecandid_derivecrates to use IDL* types. This allows us to enrich the IDL* types e.g. with comments later on, without affecting serialization and deserialization performance.Requirements
Blocked by:
IDL*types into the candid crate #622didc testsubcommand #623Considerations
Breaking change.