-
-
Save anonymous/1c5eb389aeacd9c5b894de338f918423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn map_type(comptime Type: type) type | |
{ | |
if (Type == u32) return f32; | |
return f64; | |
} | |
fn compute_result(comptime Type: type) type | |
{ | |
var computed_value: map_type(Type) = 1.0; | |
return struct { var data = computed_value; }; | |
} | |
fn test_return_type_inference(comptime Type: type) @typeOf(compute_result(Type).data) | |
{ | |
return compute_result(Type).data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment