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

Cyclic imports are possible #4902

Open
Feoramund opened this issue Mar 2, 2025 · 1 comment
Open

Cyclic imports are possible #4902

Feoramund opened this issue Mar 2, 2025 · 1 comment

Comments

@Feoramund
Copy link
Contributor

I unwittingly created a cyclic import that bypassed the compiler. Here's the minimal reproduction:

main.odin

package main

import "cool:b"

import "core:fmt"

main :: proc() {
	fmt.println("Hellope", b.pro())
}

a/a.odin

package a

import "cool:a"
import "cool:b"

N :: 96

pro :: proc() -> int {
	return b.M * 2
}

b/b.odin

package b

import "cool:b"
import "cool:a"

M :: 16

pro :: proc() -> int {
	return a.pro() + a.N
}

Run with odin run . -collection:cool=. and see that it compiles and outputs Hellope 128. It seems like the package itself must import itself before any others in order to bypass the restriction. Tested with odin version dev-2025-03:4b2b49dc3.

@gingerBill
Copy link
Member

Well fuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants