regression/fail/modules.51.sml
raw| 1 | (* |
| 2 | * This example tests that a variable type containing unknown types is not |
| 3 | * mistakenly generalized when matching a signature. |
| 4 | *) |
| 5 | structure S: |
| 6 | sig |
| 7 | val f: 'a option -> 'a option |
| 8 | end = |
| 9 | struct |
| 10 | val f = |
| 11 | let |
| 12 | val r = ref NONE |
| 13 | in |
| 14 | fn z => (!r before (r := z)) |
| 15 | end |
| 16 | end |
| 17 | |
| 18 | val _ = S.f (SOME 13) |
| 19 | |
| 20 | val _ = |
| 21 | case S.f (SOME (fn z => z)) of |
| 22 | NONE => 15 |
| 23 | | SOME f => f 17 |