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

generics+traits: Using return type of a trait with a generic causes compiler panic #1309

Open
hughdavenport opened this issue Jan 1, 2023 · 0 comments

Comments

@hughdavenport
Copy link

Hi,

Got the following source:

/// Expect:
/// - output: "OK\n"

struct Thing<T> implements(IntoIterator<T>) {
    function iterator(this) -> Iterable<T> {
	// TODO do something, panics in compiler before checking body
    }
}
function main() {
    println("OK")
}

Compiling this gives the following error:

internal error: Generic trait instance in codegen
/bin/bash: line 1: 2026409 Aborted                 (core dumped) ./build/bin/jakt test.jakt

The following smaller example also panics:

/// Expect:
/// - output: "OK\n"

trait Trait<T> { }
struct Thing<T> {
    function func(this) -> Trait<T> {
	// TODO do something, panics in compiler before checking body
    }
}
function main() {
    println("OK")
}

Unsure of a workaround just yet.

Cheers,

Hugh

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

1 participant