shithub: mc

Download patch

ref: 076907e11308f988a76dc73fc97641e2ae6b238e
parent: b92973e28b8affb30ef3dfe2acf2cc47f95a3e95
author: Ori Bernstein <[email protected]>
date: Fri Sep 13 12:54:33 EDT 2013

Adds test for explicitly instantiated generic type.

--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -8,6 +8,7 @@
     error.myr \
     extremum.myr \
     fmt.myr \
+    htab.myr \
     intparse.myr \
     now.myr \
     option.myr \
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -137,7 +137,7 @@
 struct Ucon {
     int line;   /* line declared on */
     size_t id;  /* unique id */
-    int synth;  /* is it generated? */
+    Vis vis;    /* is it generated? */
     Node *name; /* ucon name */
     Type *utype;        /* type of the union this is an element of */
     Type *etype;        /* type for the element */
--- /dev/null
+++ b/test/genericret.myr
@@ -1,0 +1,17 @@
+use std
+
+type t(@a) = union
+	`Val @a
+	`None
+;;
+
+const f = {-> t(int)
+	-> `None
+}
+
+const main = {
+	match f()
+	`None:	-> 42;;
+	;;
+	-> 0
+}
--- a/test/tests
+++ b/test/tests
@@ -61,6 +61,7 @@
 B trait-builtin	E	42
 B genericcall	E	42
 B generictype	E	0
+B genericret	E	42
 B genericrec	E	0
 B sizeof	E	4
 B gsizeof	E	5