mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Expand inference.
This commit is contained in:
14
test/test_suite/generic/generic_infer_mismatch.c3
Normal file
14
test/test_suite/generic/generic_infer_mismatch.c3
Normal file
@@ -0,0 +1,14 @@
|
||||
import std;
|
||||
struct Result @generic(WithType2)
|
||||
{
|
||||
fault error;
|
||||
}
|
||||
macro err(fault error) @generic(OfType, SOME_CONST) @builtin => (Result{OfType}){ .error = error };
|
||||
|
||||
faultdef TESTIN;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Result{int} x = err(TESTIN); // #error: Found 'err' in the module 'generic_infer_mismatch', but it lacks parameters
|
||||
return 0;
|
||||
}
|
||||
14
test/test_suite/generic/generic_infer_ok.c3
Normal file
14
test/test_suite/generic/generic_infer_ok.c3
Normal file
@@ -0,0 +1,14 @@
|
||||
import std;
|
||||
struct Result @generic(WithType2)
|
||||
{
|
||||
fault error;
|
||||
}
|
||||
macro err(fault error) @generic(OfType) @builtin => (Result{OfType}){ .error = error };
|
||||
|
||||
faultdef TESTIN;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Result{int} x = err(TESTIN);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user