summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/language-feature/lambda/coerce-failure.slang19
-rw-r--r--tests/language-feature/lambda/coerce-to-functype.slang13
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/language-feature/lambda/coerce-failure.slang b/tests/language-feature/lambda/coerce-failure.slang
new file mode 100644
index 000000000..a5286611c
--- /dev/null
+++ b/tests/language-feature/lambda/coerce-failure.slang
@@ -0,0 +1,19 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+
+func test(f: functype(int, int)->float) -> float
+{
+ return f(2,3) + 10.0f;
+}
+
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ int c = 2;
+ // CHECK: ([[# @LINE+1]]): error 30019
+ let result = test((int x, int y)=> x + y + c);
+
+ // CHECK: ([[# @LINE+1]]): error 30019
+ let result1 = test((int x, float y) => x + y);
+} \ No newline at end of file
diff --git a/tests/language-feature/lambda/coerce-to-functype.slang b/tests/language-feature/lambda/coerce-to-functype.slang
new file mode 100644
index 000000000..9ec430def
--- /dev/null
+++ b/tests/language-feature/lambda/coerce-to-functype.slang
@@ -0,0 +1,13 @@
+//TEST:INTERPRET(filecheck=CHECK):
+
+func test(f: functype(int, int)->float) -> float
+{
+ return f(2,3) + 10.0f;
+}
+
+func main()
+{
+ let result = test((int x, int y)=>x+y);
+ // CHECK: 15.0
+ printf("%f\n", result);
+} \ No newline at end of file