Skip to content

Commit 76af695

Browse files
committed
fix: bool debug display
1 parent bce39bf commit 76af695

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.vscode/launch.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
"program": "plc",
5555
"preLaunchTask": "install debug plc"
5656
},
57+
{
58+
"type": "pivot",
59+
"request": "launch",
60+
"name": "pivot-lang: Launch",
61+
"program": "${workspaceFolder}/test/Kagari.toml"
62+
},
5763
{
5864
"type": "lldb",
5965
"request": "launch",

src/ast/builder/llvmbuilder.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,13 @@ impl<'a, 'ctx> LLVMBuilder<'a, 'ctx> {
497497
return Some(st);
498498
}
499499
PLType::PRIMITIVE(pt) => {
500+
let mut size = td.get_bit_size(&self.get_pri_basic_type(pt));
501+
if size < 8 {
502+
size = 8; // walkaround for lldb <Unable to determine byte size.> issue
503+
}
500504
return Some(
501505
self.dibuilder
502-
.create_basic_type(
503-
&pt.get_name(),
504-
td.get_bit_size(&self.get_pri_basic_type(pt)),
505-
get_dw_ate_encoding(pt),
506-
0,
507-
)
506+
.create_basic_type(&pt.get_name(), size, get_dw_ate_encoding(pt), 0)
508507
.unwrap()
509508
.as_type(),
510509
);

src/ast/test.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,13 @@ mod test {
414414
let o = Command::new(exe.to_str().unwrap())
415415
.output()
416416
.expect("failed to execute compiled program");
417-
assert!(o.status.success());
417+
let msg = format!(
418+
"static compiled program failed with status {:?} and output {:?} and error {:?}",
419+
o.status,
420+
String::from_utf8_lossy(&o.stdout),
421+
String::from_utf8_lossy(&o.stderr)
422+
);
423+
assert!(o.status.success(), "{}", &msg);
418424
input.set_action(&mut db).to(ActionType::PrintAst);
419425
compile(
420426
&db,

test/main.pi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ fn test_generic_fn_complex<A|B|C>(a: i64, x: A, y: B, z: C) void {
354354
}
355355

356356
fn main() i64 {
357+
let a = true;
357358
let a1 = [[[1, 2], [1, 2]]];
358359
io::printi64ln(a1[0][0][0]);
359360
test_struct();

0 commit comments

Comments
 (0)