Added test for generics

This commit is contained in:
Mattia Giambirtone 2023-12-05 12:49:16 +01:00
parent a6a944a4fa
commit 34d5f77f65
Signed by: nocturn9x
GPG Key ID: 8270F9F467971E59
1 changed files with 15 additions and 0 deletions

15
tests/generics.pn Normal file
View File

@ -0,0 +1,15 @@
type int64 = object {
#pragma[magic: "int64"]
}
type Test<T: int64>[V: int64] = object {
typeObj: T;
value: V;
}
Test[int64, 1]; # Works
# Test[int64, int64]; # Error: expecting an expression of type int64, got typevar[int64] instead
# Test[1, int64]; # Error: expecting an expression of type typevar[int64], got int64 instead