Merge changes Ia9ba2193,I736bf655

* changes:
  Remove empty SECTION
  Fix leafTypeName returning names of primitive types
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 6021cc5..132c25f 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -304,7 +304,7 @@
 std::optional<std::string> YangSchema::leafTypeName(const std::string& path) const
 {
     libyang::Schema_Node_Leaf leaf(getSchemaNode(path));
-    return leaf.type()->der().get() ? std::optional{leaf.type()->der()->name()} : std::nullopt;
+    return leaf.type()->der().get() && leaf.type()->der()->type()->der().get() ? std::optional{leaf.type()->der()->name()} : std::nullopt;
 }
 
 std::string YangSchema::leafrefPath(const std::string& leafrefPath) const
diff --git a/src/yang_schema.hpp b/src/yang_schema.hpp
index 2a93b07..a4c0b90 100644
--- a/src/yang_schema.hpp
+++ b/src/yang_schema.hpp
@@ -41,6 +41,7 @@
     const std::set<std::string> listKeys(const schemaPath_& location, const ModuleNodePair& node) const override;
     yang::TypeInfo leafType(const schemaPath_& location, const ModuleNodePair& node) const override;
     yang::TypeInfo leafType(const std::string& path) const override;
+    /** @brief If the leaf type is a typedef, returns the typedef name. */
     std::optional<std::string> leafTypeName(const std::string& path) const override;
     std::string leafrefPath(const std::string& leafrefPath) const override;
     std::set<ModuleNodePair> availableNodes(const boost::variant<dataPath_, schemaPath_, module_>& path, const Recursion recursion) const override;
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 79bad71..3d42c5e 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -1184,8 +1184,10 @@
             REQUIRE(ys.defaultValue("/example-schema:leafInt32") == std::nullopt);
         }
 
-        SECTION("moduleNodes")
+        SECTION("leafTypeName")
         {
+            REQUIRE(ys.leafTypeName("/example-schema:leafEnumTypedefRestricted") == "enumTypedef");
+            REQUIRE(ys.leafTypeName("/example-schema:leafInt32") == std::nullopt);
         }
     }