-
Notifications
You must be signed in to change notification settings - Fork 7
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
bug: Recursive generic definition fails to resolve #127
Comments
This is a problem with the current internal ImlValue design. |
- Added tests from README, as they previously failed! - Bug #127 in ImlValue should be fixed later, as it is a design issue
a10b45a paves the way for release v0.6.5, which supports generic parselets. This issue won't be resolved for this version, and must be resolved by a future refactor or redesign. This issue is currently referenced in the panic, in case somebody gets into it. Current resolve for the problem presented above is to define HoldAssignment as a separate parselet:
|
This is a proposal, which seems to fix tokay-lang#127.
Better example, currently tested with compiler-rework-test branch contents:
A correct run of this program would look like this:
The problem is generally that an I did some tests in fn traverse_node_static(scope: &Scope, assign: Option<String>, node: &Dict) -> ImlValue {
let emit = node["emit"].borrow();
let emit = emit.object::<Str>().unwrap().as_str();
if emit.starts_with("value_") && (emit != "value_generic" || assign.is_none()) {
traverse_node_value(scope, node, assign)
} else {
// Handle anything else as an implicit parselet in its own scope
let implicit_parselet = ImlParselet::new(ImlParseletInstance::new(
None,
None,
traverse_node_offset(node),
assign,
5,
false,
));
implicit_parselet.borrow().model.borrow_mut().body = {
match traverse_node_rvalue(
&scope.shadow(ScopeLevel::Parselet(implicit_parselet.clone())),
node,
Rvalue::CallOrLoad,
) {
ImlOp::Nop => return value!(void).into(),
// Defined value call without parameters, or load becomes just the value
ImlOp::Load { target: value, .. }
| ImlOp::Call {
target: value,
args: None,
..
} if emit != "value_generic" => return value,
// Any other code becomes its own parselet without any signature.
body => body,
}
};
ImlValue::from(implicit_parselet)
}
} |
This isn't the correct solution, but the concept on this branch is better than before, and should be merged first.
This issue is still existing and should be kept open! |
This program
generates the panic
The text was updated successfully, but these errors were encountered: