Skip to content

fix issue resolving overload with polymorphic arguments when passed …#1496

Merged
BradLewis merged 2 commits into
DanielGavin:masterfrom
DarathDev:overload_poly_pointer
May 26, 2026
Merged

fix issue resolving overload with polymorphic arguments when passed …#1496
BradLewis merged 2 commits into
DanielGavin:masterfrom
DarathDev:overload_poly_pointer

Conversation

@DarathDev
Copy link
Copy Markdown
Contributor

@DarathDev DarathDev commented May 23, 2026

…a pointer to a generic from another function

Attempts to fix #1495

The problem seems to be that during resolve_generic_function_symbol the parameter resolves to the type without the pointer, as symbol_to_expr doesn't retain that information. I am not certain if that is intended. The changes in this pull request change that, but it breaks several other tests, and causes the server to crash.

Is there another mechanism by which this information should normally be retained, or is it an oversight of symbol_to_expr?

@BradLewis
Copy link
Copy Markdown
Collaborator

I'm not 100% sure, but if it's breaking other tests like that it's probably intended to work like this. My guess is it's something like it's not correctly recursing down to realise it should be a ^Bar and not just a Bar.

This should be a similar test case that demonstrates the same problem which should make debugging easier.

package test

Bar :: struct{}

bar_ptr :: proc(value: $T) -> ^T {}

bar_pass :: proc(value: $T) -> T {}

main :: proc() {
	b := bar_ptr(Bar{})
	c := bar_pass(b)
}

@DarathDev DarathDev force-pushed the overload_poly_pointer branch from 704e94c to 40be398 Compare May 26, 2026 00:27
DarathDev added 2 commits May 25, 2026 22:22
clone_node does currently ensure derived_expr or derived_stmt are kept in sync with derived, so they are not necessarily correct.
@DarathDev DarathDev force-pushed the overload_poly_pointer branch from 40be398 to e2c46ee Compare May 26, 2026 04:23
@DarathDev DarathDev marked this pull request as ready for review May 26, 2026 04:26
@BradLewis
Copy link
Copy Markdown
Collaborator

Thanks! Works well for me.

@BradLewis BradLewis merged commit 6f8c92b into DanielGavin:master May 26, 2026
3 checks passed
@DarathDev DarathDev deleted the overload_poly_pointer branch May 26, 2026 17:34
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

Successfully merging this pull request may close these issues.

[Bug] Poly overloads fail to resolve when passed a return which is a pointer

2 participants