-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix prebound parameter pack - argument list matching logic. (#6111)
* Fix prebound parameter pack - argument list matching logic. * Move tests. * Fix.
- Loading branch information
Showing
4 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
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
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
28 changes: 28 additions & 0 deletions
28
tests/language-feature/generics/prebound-variadic-pack.slang
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//TEST:SIMPLE(filecheck=CHECK): -target spirv | ||
|
||
struct Set<each T> | ||
{ | ||
Tuple<expand each T> data; | ||
void f(expand each T v){} | ||
void h<each U>(U x){} | ||
void g(expand each T d) | ||
{ | ||
//CHECK-NOT: ([[# @LINE+1]]): error | ||
f(expand each d); // OK | ||
|
||
//CHECK-NOT: ([[# @LINE+1]]): error | ||
h(54); // OK, specializing free-form parameter U. | ||
|
||
//CHECK: ([[# @LINE+1]]): error | ||
f(); // error, cannot call f without arguments. | ||
|
||
//CHECK: ([[# @LINE+1]]): error | ||
f(5); // error, cannot call f with different type pack. | ||
} | ||
} | ||
|
||
[numthreads(1,1,1)] | ||
void computeMain() | ||
{ | ||
Set<float> v; | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/language-feature/generics/variadic-tuple-field.slang
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type | ||
|
||
struct Set<each T> | ||
{ | ||
Tuple<expand each T> data; | ||
void f(expand each T v){} | ||
__init(expand each T d) { | ||
f(d); | ||
data = makeTuple(d); | ||
} | ||
} | ||
|
||
//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4) | ||
RWStructuredBuffer<float> outputBuffer; | ||
|
||
[numthreads(1,1,1)] | ||
void computeMain() | ||
{ | ||
let set = Set<float>(1.0); | ||
outputBuffer[0] = set.data._0; | ||
// CHECK: 1.0 | ||
} |