Skip to content

[TRACKER] PR #367 #379

@jaibugbot

Description

@jaibugbot
Emailed In Reported Version Latest Broken Version Latest Broken Platforms Fix Version
beta-0.1.096 beta-0.2.010 windows, linux -

Description

compiler can't choose right overloading, but only in some cases.

Buggy Code

#import "Basic";

foo :: ($T : Type, proc : (*T)->()) {
	x : T;
	proc(*x);
}

bar :: (x : *string) {
	print("string\n");
}
bar :: (x : *int) {
	print("int\n");
}

Foo :: struct(T : Type, proc : (*T)->()) { }

main :: () {
	foo1 :: #bake_arguments foo(T = int);
	// can decide which "bar" was meant
	foo1(bar);

	// can decide
	Foo1 :: #bake_arguments Foo(T = int);
	Foo1(bar).proc(null);

	// can't
	foo2 :: #bake_arguments foo1(proc = bar);
	foo2();

	// can't
	Foo2 :: #bake_arguments Foo1(proc = bar);
	Foo2.proc(null);

	// can't
	Foo3 :: Foo(int, bar);
	Foo3.proc(null);
}

Workarounds

-

Latest Test Outputs


windows
Compiler Error Output

In Workspace 2 ("Target Program"):
C:/Users/Private/Desktop/testo_runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/379_367_CEC0.jai:27,38: Error: Type mismatch between the arguments when comparing two procedures. Type wanted: *int; type given: *string.

    	// can't
    	foo2 :: #bake_arguments foo1(proc = bar);
                                         ^^^


linux
Compiler Error Output

In Workspace 2 ("Target Program"):
/home/ubuntu/Desktop/actions-runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/379_367_CEC0.jai:27,38: Error: Type mismatch between the arguments when comparing two procedures. Type wanted: *int; type given: *string.

    	// can't
    	foo2 :: #bake_arguments foo1(proc = bar);
                                         ^^^



History V1

Version Windows Linux Mac
beta-0.2.010 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.009 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.008 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.007 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.006 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.005 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.004 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.003 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.002 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.001 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.1.096 ❌ - ExitCode 1 ❌ - ExitCode 1 -

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions