Skip to content

[Enhancement] Type inference on && #2172

@BWindey

Description

@BWindey

Currently type-inference is not fully covered when using &&, as demonstrated in the below example:

macro test(ushort* x) {
	return *x;
}

fn void main() {
	assert(test(&&4) == 4);
}

Compiling this gives:

 3: }
 4: 
 5: fn void main() {
 6: 	assert(test(&&4) == 4);
    	            ^^^
Error: Implicitly casting 'int*' to 'ushort*' is not permitted, but you may do an explicit cast by placing '(ushort*)' before the expression.

Same goes for using anything that is not an int (uint, char, long, ...).

It would be a nice enhancement if inference could resolve it.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions