summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/generic-type-arg-overloaded.slang33
-rw-r--r--tests/bugs/generic-type-arg-overloaded.slang.expected11
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/bugs/generic-type-arg-overloaded.slang b/tests/bugs/generic-type-arg-overloaded.slang
new file mode 100644
index 000000000..99150d2f0
--- /dev/null
+++ b/tests/bugs/generic-type-arg-overloaded.slang
@@ -0,0 +1,33 @@
+// generic-type-arg-overloaded.slang
+
+//DIAGNOSTIC_TEST:SIMPLE:
+
+// Regression test to confirm that type checker
+// doesn't crash when an overloaded identifier
+// is used as a generic type argument.
+
+interface IThing { int getVal(); }
+
+struct Stuff : IThing { int getVal() { return 1; } }
+
+// Conflicting declaration:
+struct Stuff {}
+
+int util<T : IThing>() { return 1; }
+
+struct G {}
+int nonGeneric() { return 2; }
+
+int test()
+{
+ // This call should note the ambiguity,
+ // rather than crash.
+ //
+ return util<Stuff>()
+
+ // Adding an extra call to also test the
+ // case of trying to speicalize something
+ // like a generic when it isn't one.
+ //
+ + nonGeneric<G>();
+}
diff --git a/tests/bugs/generic-type-arg-overloaded.slang.expected b/tests/bugs/generic-type-arg-overloaded.slang.expected
new file mode 100644
index 000000000..518abc2b1
--- /dev/null
+++ b/tests/bugs/generic-type-arg-overloaded.slang.expected
@@ -0,0 +1,11 @@
+result code = -1
+standard error = {
+tests/bugs/generic-type-arg-overloaded.slang(14): error 30200: declaration of 'Stuff' conflicts with existing declaration
+tests/bugs/generic-type-arg-overloaded.slang(11): note: see previous declaration of 'Stuff'
+tests/bugs/generic-type-arg-overloaded.slang(26): error 39999: ambiguous reference to 'Stuff'
+tests/bugs/generic-type-arg-overloaded.slang(14): note 39999: candidate: Stuff
+tests/bugs/generic-type-arg-overloaded.slang(11): note 39999: candidate: Stuff
+tests/bugs/generic-type-arg-overloaded.slang(32): error 39999: expected a generic when using '<...>' (found: '() -> int')
+}
+standard output = {
+}