Auditing callers after an interface change

A warehouse team is reviewing a proposed change to a screening helper. The original interface accepts an integer record number and a Boolean override, returning an integer review code:


Plain text
screen: (Int, Bool) -> Int


The revised interface accepts an integer record number and an integer priority, returning a Boolean approval:


Plain text
screen: (Int, Int) -> Bool


Assume each implementation satisfies its declared interface. Check every expression below independently under each interface, without modifying any expression. Integer literals have type Int, and true and false have type Bool. Addition requires two Int operands and returns Int. Function arguments must match exactly. A conditional requires a Bool condition and branches of the same type; it checks both branches even when its condition is false. There are no implicit conversions or additional value checks.


Fragment

Expression

Packing

screen(52, true) + 9

Priority test

if screen(46, 7) then 28 else 15

Arithmetic

screen(63, 11) + 4

Disabled route

if false then screen(58, true) else 12

Boolean fallback

if false then screen(71, 6) else true

Chained review

if screen(83, 5) then screen(39, 10) else false


How many of the six fragments pass static type checking under the original interface, and how many pass under the revised interface? Give both counts as exact whole numbers of fragments.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Type Checking and Inference Questions: