CMakePP / CMakePPLang

Object-oriented extension to the CMake language.
http://cmakepp.github.io/CMakePPLang/
Apache License 2.0
11 stars 4 forks source link

Pointer types supported in signatures #96

Closed AutonomicPerfectionist closed 1 year ago

AutonomicPerfectionist commented 1 year ago

Is your feature request related to a problem? Please describe. Here the documentation introduces the concept of pointer types, but it does not appear as if these types are supported in signatures. For example, the following fails:

function(test_func _tf_type)
    cpp_assert_signature("${ARGV}" type*)
endfunction()

set(CMAKEPP_LANG_DEBUG_MODE ON)

set(type_pointer "bool")
test_func(type_pointer)

The documentation mentions "it will only enforce that the provided argument is of type desc" when a function says the argument is of a pointer type. One interpretation of this is that users should document a pointer type in the doccomment, while putting desc in the call to cpp_assert_signature(), but another would be cpp_assert_signature() accepts pointer types but internally treats them like desc.

Describe the solution you'd like The documentation is a bit unclear on how to use pointer types. If we don't want to support them in signatures, it should be specified somewhere explicitly that signatures must use desc in place of pointer types.

Otherwise, if pointer type support is desired, I think I have a rough implementation I threw together over a couple of minutes, and I could flesh it out in a full PR.

Additional context This issue was discovered while refining method signatures in CMakeTest

ryanmrichard commented 1 year ago

but another would be cpp_assert_signature() accepts pointer types but internally treats them like desc.

I like this behavior. If you can make a PR that fleshes that out that would be great!