Skip to content
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

Assertion failure with return signature -> $int #3949

Open
adimemir-prog opened this issue Jul 20, 2024 · 2 comments
Open

Assertion failure with return signature -> $int #3949

adimemir-prog opened this issue Jul 20, 2024 · 2 comments
Labels

Comments

@adimemir-prog
Copy link

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
Copy link
Author

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.

@laytan
Copy link
Sponsor Collaborator

laytan commented Jul 28, 2024

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 laytan changed the title odin check fails to detect a type error Assertion failure with return signature -> $int Jul 28, 2024
@laytan laytan added the bug label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants