Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Assertion failure with return signature `-> $int`

Open adimemir-prog opened this issue 1 year ago • 2 comments

Context

  • Operating System & Odin Version:
  • using odin-windows-amd64-nightly+2024-07-19

Odin: dev-2024-07-nightly:7237f9c OS: Windows 10 Professional (version: 22H2), build 19045.4412 CPU: AMD Ryzen 5 5600 6-Core Processor
RAM: 16305 MiB Backend: LLVM 18.1.8

Expected Behavior

odin check main.odin -file should fail with a meaningful message indicating $int is nonsensical.

Current Behavior

'odin check main.odin -file' succeeds but 'odin build main.odin -file' fails with message ...Odin\Odin\src\llvm_backend_general.cpp(1819): Assertion Failure: type != t_invalid

Steps to Reproduce

odin check main.odin -file then odin build main.odin -file

main.odin:

package main
main :: proc()
{
	
} // main
triangle :: proc(n: int) -> $int {
	return n*(n+1)/2
}

adimemir-prog avatar Jul 20 '24 08:07 adimemir-prog

However if we add

run :: proc() -> int 
{
	return triangle(1)
}

then it is detected, so 'odin check' only detects this if the procedure with parapoly return value is called somewhere.

adimemir-prog avatar Jul 20 '24 08:07 adimemir-prog

This is expected behavior, parapoly procedures must be called for them to be checked.

However, the assertion failure that happens after you do use it is a bug so I will leave this open for that.

laytan avatar Jul 28 '24 12:07 laytan