Describe the bug
If you try to write a mixed constraint like valueof string over a scalar initializer parameter, you get no diagnostics until that initializer is actually called. At the call site, the only error is about the value being unassignable to ErrorType, rather than anything to do with the invalid constraint.
Scalar initializers do not accept mixed constraints and behave as if all of their parameter constraints have valueof in front of them.
Reproduction
https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=c2NhbGFyIFMgewogIGluaXQgaShzOiB2YWx1ZW9mIHN0cmluZyk7Cn0KCmNvbnN0IHM6IFMgPSBTLmkoImZvbyIpOw%3D%3D&v=type-graph&vs=%7B%22type-graph%3Apath%22%3A%22%24.%28global%29.scalars.S.constructors.i.parameters.0%22%7D&options=%7B%7D
Checklist
Describe the bug
If you try to write a mixed constraint like
valueof stringover a scalar initializer parameter, you get no diagnostics until that initializer is actually called. At the call site, the only error is about the value being unassignable to ErrorType, rather than anything to do with the invalid constraint.Scalar initializers do not accept mixed constraints and behave as if all of their parameter constraints have
valueofin front of them.Reproduction
https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=c2NhbGFyIFMgewogIGluaXQgaShzOiB2YWx1ZW9mIHN0cmluZyk7Cn0KCmNvbnN0IHM6IFMgPSBTLmkoImZvbyIpOw%3D%3D&v=type-graph&vs=%7B%22type-graph%3Apath%22%3A%22%24.%28global%29.scalars.S.constructors.i.parameters.0%22%7D&options=%7B%7D
Checklist