Skip to content

bug: variable access (LRU) usage on enum children values causes panics #78

@Zffu

Description

@Zffu

Code to cause the Error

shadowfunc printf(staticstr fmt, s32 haii)

struct test {
	s32 hai
	s64 hellos
}

func main() {
	var test meow = { hai: 35, hellos: 54 }	
	var result::value<s32, s64> meows = { val: 58 }
	var result<s32, s64> res = meows

	if(unwrap<res, result::value<s32, s64>, test>) {
		printf("Meow: %d", test.val)
	}
}

Encountered Error

error[E99]: unsure panic: invalid function argument types!
  --> ./test.qf:14:21
   |
   |    printf("Meow: %d", test.val)
   |                         ^^^^^^^^
   |                         panic happened here
   |
   = note: Report this at https://github.com/Quickfall/quickfall
   = help: create a bug report

This bug is most likely caused by the hint parameter being at the start of the enum value but not taken into account in LRU nodes. This can be an issue with any structure layout that changes from HIR -> MIR. A possible solution is to make a table into LoweredStruct types storing HIR field index -> MIR field index

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions