You can't use respond_to? here (it's not defined at this point). That's why the build fails at loading prims. Maybe do this:
```ruby
filename = Type.__coerce_to_String_to_s(filename)
```