Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PUP 4.4.1
-
None
-
None
-
1
-
Language 2016-04-06
-
Bug Fix
-
The function assert_type has been improved to point out details about a type mismatch where it earlier in some cases would report nonsense like "Expected Hash, got Hash"
Description
The function assert_type will currently call TypeCalculator#infer to infer the type of the given value. This means that a lot of information is lost. A hash is for instance reduced to a key and value type and the correlation between the keys and values are lost. This was OK when the assert_type had a very simplistic way of reporting a mismatch but today, when it uses the TypeMismatchDescriber, a call to TypeCalculator#infer_set will result in much better output when a mismatch is detected.
ACCEPTANCE CRITERIA
- That the actual mismatch is pointed out when it is in the details e.g. that the below shows that:
assert_type(Struct[{ a => Integer, b => Boolean }], { a => hello, x => world })
- a has wrong type
- b is missing
- there is no x in the struct
Attachments
Issue Links
- links to