summary refs log tree commit diff stats
path: root/tests/operator/tofopr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/operator/tofopr.nim')
-rw-r--r--tests/operator/tofopr.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/operator/tofopr.nim b/tests/operator/tofopr.nim
new file mode 100644
index 000000000..961d81bd3
--- /dev/null
+++ b/tests/operator/tofopr.nim
@@ -0,0 +1,26 @@
+discard """
+  file: "tofopr.nim"
+  output: "falsetrue"
+"""
+# Test is operator
+
+type
+  TMyType = object {.inheritable.}
+    len: int
+    data: string
+    
+  TOtherType = object of TMyType
+   
+proc p(x: TMyType): bool = 
+  return x of TOtherType
+    
+var
+  m: TMyType
+  n: TOtherType
+
+write(stdout, p(m))
+write(stdout, p(n))
+
+#OUT falsetrue
+
+