Commit c67ada27 authored by Alexandru Dura's avatar Alexandru Dura
Browse files

Tests for nonnull qualified struct members

parent 99d19ca8
// IN: 0
// EXCEPTION: lang.ir.QualifierException
// IN: 5
// OUT: 5
type Pair[S, T](fst : S, snd : T);
fun null_producer(n : int) = if (n == 0) { return null; } else { return n; }
fun main(n : int) = {
var p : Pair := new Pair[nonnull int, int](0, 1);
p.snd := null; // this should be fine
p.fst := null_producer(n);
return p.fst;
}
\ No newline at end of file
// IN: 0
// EXCEPTION: lang.ir.QualifierException
// IN: 5
// OUT: 5
type Pair(fst : nonnull int, snd : int);
fun null_producer(n : int) = if (n == 0) { return null; } else { return n; }
fun main(n : int) = {
var p : Pair := new Pair(0, 1);
p.snd := null; // this should be fine
p.fst := null_producer(n);
return p.fst;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment