Merge branch 'master' of github.com:dopefishh/cc1516
[cc1516.git] / examples / Markus / polymorphic_value_shouldfail.spl
1 // This is an example why you need the value restriction.
2 // This program should give a type error in some way.
3
4 // The empty list [] usually has polymorphic type forall a.[a], but you
5 // cannot give the variable l this type. See below what can go wrong.
6 var l = [];
7
8 f()
9 {
10 // If l has polymorphic type forall a . [a], the next two lines are possible.
11 l = 1:l;
12 l = True:l;
13 return;
14 }