New Issue: Problem combining tuple unpacking formal and type queries

23302, "mppf", "Problem combining tuple unpacking formal and type queries", "2023-09-11T17:21:07Z"

The compiler is giving strange errors when tuple unpacking and type queries are combined in a formal. This bug report came from Repeated query of size of type in argument list - #3 by mppf

use Math;

//inline proc cmplx1((x , y) : (real(?w), imag(?w)))
//{
//  writeln(w); // error: w undeclared [should be an error about w being redeclared]
//  return x * exp(y);
//}

// error: unable to resolve type
//inline proc cmplx((x , y)) where isRealType(x.type) && isImagType(y.type)
//{
//    return x * exp(y);
//}

// this version seems to work
// note: you could add `numBits(tup(0).type) == numBits(tup(1).type)`
//       if you want the real and imag to be the same width.
inline proc cmplx(tup)
  where isTuple(tup) && isRealType(tup(0).type) && isImagType(tup(1).type)
{
  const (x,y) = tup;
  return x * exp(y);
}

writeln(cmplx( (1.0, 40.0i) ));