about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-24T15·09+0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-24T15·09+0200
commit94f11d0a61bba15ff8a93f2de8d1883783c8c508 (patch)
tree82123ffdd10ecff586c8775bf484d0c73be46de8 /src
parent99cec651c9c1d95656e182871f0bb186f798077c (diff)
Fix abort in fromTOML
Fixes #2969.
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops/fromTOML.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libexpr/primops/fromTOML.cc b/src/libexpr/primops/fromTOML.cc
index 4128de05d0cf..a84e569e944d 100644
--- a/src/libexpr/primops/fromTOML.cc
+++ b/src/libexpr/primops/fromTOML.cc
@@ -49,6 +49,19 @@ static void prim_fromTOML(EvalState & state, const Pos & pos, Value * * args, Va
                 visit(*(v.listElems()[i] = state.allocValue()), t2->get()[i]);
         }
 
+        // Handle cases like 'a = [[{ a = true }]]', which IMHO should be
+        // parsed as a array containing an array containing a table,
+        // but instead are parsed as an array containing a table array
+        // containing a table.
+        else if (auto t2 = t->as_table_array()) {
+            size_t size = t2->get().size();
+
+            state.mkList(v, size);
+
+            for (size_t j = 0; j < size; ++j)
+                visit(*(v.listElems()[j] = state.allocValue()), t2->get()[j]);
+        }
+
         else if (t->is_value()) {
             if (auto val = t->as<int64_t>())
                 mkInt(v, val->get());