Merge: core: fix dynamic error on the input type in `Text::replace`
authorJean Privat <jean@pryen.org>
Wed, 17 May 2017 13:53:35 +0000 (09:53 -0400)
committerJean Privat <jean@pryen.org>
Wed, 17 May 2017 13:53:35 +0000 (09:53 -0400)
commitefd48b7d9f2074ce7c42dcce870f4b26fed49248
treef3f83f8fc66317f352941ac6323098bdf83cd6e2
parentda83c1f23934be38cbb8d20c490a87758ad52594
parentff3289b5e8013ec0a64289966557f530ffbdcb7a
Merge: core: fix dynamic error on the input type in `Text::replace`

The previous use of the virtual `SELFTYPE` on a parameter of `replace` was too restrictive and caused a dynamic crash when replacing something in a  `String` by a `FlatBuffer` (for example). This PR uses the more general `Text` as the parameter type, which is already supported by the existing implementation.

The minimal case is not the most useful as doc but I've added it as a unit test anyway:
~~~
var t: Text = "hello"
assert t.replace("hello", new FlatBuffer) == ""
~~~

Pull-Request: #2447