Question: How to use the type ':-RandomVariable' in the parameters sequence of a procedure?

Hi, 
I met a an unexpected behaviour of a procedure when the parameter sequence contains the type ':-RandomVariable':  

restart:
with(Statistics):
f1 := proc(A::':-RandomVariable')
  Mean(A)
end proc:

Z := RandomVariable(Normal(mu, sigma)):
hastype(Z, ':-RandomVariable');
f1(Z)
                              true
Error, invalid input: f1 expects its 1st argument, A, to be of type 'RandomVariable', but received _R
# Another attempt
f2 := proc(A)
  if hastype(A, ':-RandomVariable') then Mean(A) end if;
end proc:

f2(Z)
                               mu

Why does f1 generate this error?

Type_RandomVariable.mw

Please Wait...