ScalaMock
ScalaMock copied to clipboard
only cast null constructor args for primitives
before, we tried to cast applied types to the type arguments, to capture context bounds. That fails for simple generic types that then get cast to the wrong type. However, that's all unnessecary: the only nulls we need to cast are primitives, which can't be passed as null. Anyting else doesn't need a cast at all
Pull Request Checklist
- [x] I agree to licence my contributions under the MIT licence
- [x] I have added copyright headers to new files
- [x] I have added tests for any changed functionality
Fixes
Fixes #519
Purpose
Fix mocking classes with generic parameters. Before, mocking class Foo(x: Option[Int])
failed
Background Context
simplifying the casts by only doing them when needed simplifies thing significantly