Detect identity conversion in toDynamic
authorAndrew Krieger <andrew.krieger@oculus.com>
Fri, 10 Feb 2017 00:54:55 +0000 (16:54 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 10 Feb 2017 01:04:44 +0000 (17:04 -0800)
commit6e4f420788bf2f9e1a6feda4ca5626f2084e6653
tree496b54b3f133ac3050f3e6cca2223c28558611fc
parent3751f5de62022e0833496c18bdb757a81d0ed3ab
Detect identity conversion in toDynamic

Summary:
D4499520 added typedefs to `dynamic` which made it start matching
tests for ranges/containers. However, the typedefs are unconditional on the
actual contents of the `dynamic`. This made toDynamic(dynamic) select the
range-based conversion operator, always, which immediately asserts when
trying to do range-based iteration over an Object or a primitive. Add tests
to the converters that enable/disable depending on whether the object is
already a `dynamic` and early-out in that case.

Reviewed By: mzlee

Differential Revision: D4538617

fbshipit-source-id: f3a5aafab07946a221dcead782fc27de51afa0a6
folly/DynamicConverter.h
folly/test/DynamicConverterTest.cpp