Skip to content

Commit

Permalink
Marked bug with self-referencing generics, SKIP rows from testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
phorward committed Nov 13, 2023
1 parent 87b6199 commit fff4aa8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
5 changes: 4 additions & 1 deletion src/compiler/iml/imlvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ impl ImlValue {
*/
pub fn resolve(&mut self, compiler: &mut Compiler) -> bool {
let resolve = match self {
Self::Unresolved(value) => return value.borrow_mut().resolve(compiler),
Self::Unresolved(value) => match value.try_borrow_mut() {
Ok(mut value) => return value.resolve(compiler),
Err(_) => todo!("Recursive resolve()"),
},
Self::Name { offset, name, .. } => compiler.get(offset.clone(), &name),
Self::Instance {
offset,
Expand Down
44 changes: 26 additions & 18 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,19 @@ pub(crate) fn testcase(code: &str) {
let line = err
.get(0)
.expect("Expecting stderr but nothing was emitted");
assert_eq!(
line,
exp,
"{}:{} stderr expects {:?} but got {:?}",
filename,
lines + row + 1,
exp,
line
);

if exp != "SKIP" {
assert_eq!(
line,
exp,
"{}:{} stderr expects {:?} but got {:?}",
filename,
lines + row + 1,
exp,
line
);
}

err.remove(0);
} else {
/*
Expand All @@ -228,15 +232,19 @@ pub(crate) fn testcase(code: &str) {
let line = out
.get(0)
.expect("Expecting stdout but nothing was emitted");
assert_eq!(
line,
exp,
"{}:{} stdout expects {:?} but got {:?}",
filename,
lines + row + 1,
exp,
line
);

if exp != "SKIP" {
assert_eq!(
line,
exp,
"{}:{} stdout expects {:?} but got {:?}",
filename,
lines + row + 1,
exp,
line
);
}

out.remove(0);
}
}
Expand Down
12 changes: 12 additions & 0 deletions tests/parselet_generic_selfref.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Y: X<Y>

X: @<X> {
'x' X
}

Y<'a'> print("Ja!")
X<'x'> print("Jx!")
#---
#ERR:SKIP
#ERR:not yet implemented: Recursive resolve()
#ERR:SKIP

0 comments on commit fff4aa8

Please sign in to comment.