summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-28 17:01:40 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-28 17:01:40 -0400
commite414e8418b0ca9dd8d49894d96ef37b12276da16 (patch)
tree57e857774c8f5f72f0c96c0b19f40294d534f2d2 /test
parentffde89c0d1f71d292d3b5cafeebe91a7ec2282bf (diff)
downloadmc-e414e8418b0ca9dd8d49894d96ef37b12276da16.tar.gz
Fix premature unification in generics.
We used to unify generics prematurely, meaning that if we had a generic being used before the declaration was fully inferred, we would fix it's type at the first use. This would cause errors when we tried to use it with a different type. A demonstration of this bug is below: const main = { id("asdf") /* we decided that id (byte[:] -> $t) */ id(123) /* type error: (byte[:] -> $t) is not compatible with (intline -> $t) */ } generic id = {x : @a -> x }
Diffstat (limited to 'test')
-rw-r--r--test/genericcall.myr8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/genericcall.myr b/test/genericcall.myr
index 5662f7d..5a1bc92 100644
--- a/test/genericcall.myr
+++ b/test/genericcall.myr
@@ -4,12 +4,12 @@ const f = {
-> 42
}
-generic id = {a:@a
- -> f()
-}
-
const main = {
id("adsf")
std.exit(id(42))
}
+generic id = {a:@a
+ -> f()
+}
+