pub fn remote_clock_dependent(
case: &Case,
expr_types: &HashMap<ExprId, TypedExpr>,
tys: &Types,
) -> Option<CompileError>Expand description
#2138 (track §3.4): bynk.test.remote_clock_dependent, a warning for a
remote run. In process every Clock reads the harness clock; a real
runtime’s Workers read wall-clock time, which the runner can’t reach. So an
expect comparing an Instant built from constants can pass in process
and fail remotely, and no --settle retry fixes that.
An expression is constant when nothing the run produced flows into it:
literals, type and static receivers (Instant.fromEpochMillis(0)), calls
whose receiver and arguments are all constant (Clock.now() included: it
reads the runner’s clock, not a Worker’s), and lets bound to constants.
Anything reached from an address’s result (a <- binding, a pattern or
lambda binding, a field of one, a call on one, or such a value shifted by
a Duration) is run-derived. A comparison with an Instant-typed
constant side warns; expect o.expires > o.created doesn’t.
Every expect in the case is scanned: top-level, in if and match
arms, in nested blocks and in the tail (where a let … else puts the
rest of the case). let constness is tracked by name through the case in
source order. #2181: a match arm’s pattern, a lambda parameter and an
is test’s bindings rebind a name to a run-derived value, so each clears
it from the constants for its scope (an is binding for the whole
predicate or if it sits in, which errs towards not warning). Reported
once per case, at the first such expect.