No `option` overloading

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

Verse does not support option overloading.

Steps to Reproduce

Func(: int): void = {}
Func(: string): void = {} # good overload
Func(: ?int): void = {} # error

Expected Result

Option overload should be permitted and compile just fine. Passing option { 42 } should use the 3rd overload, where a simple 42 should use the first overload. It should also not be limited to concrete types but should equally apply to parametric types as well.

Bar(: t where t: type): void = {}
Bar(: ?t where t: type): void = {} # should be also fine

Observed Result

Compile time error: Func(:?int) in package is ambiguous with this definition.

Platform(s)

N/A

Hey, I’d like to add some examples to your request :

1

Func(: int): void = {}
Func(: t where t:string): void = {} # ambigous

2

Func(: string): void = {}
Func(: type{_():void} ):void = {} # ambigous

3

Func(: type{_():void} ):void = {}
Func(: type{_()<suspends>:void} ):void = {} # ambigous
2 Likes

UCB-1305 incident has been created. Status is ‘Awaiting Validation’.

1 Like