Skip to content

When typing a function return as say Integer[500,1000] is not range is not respected. #9541

Open
@traylenator

Description

@traylenator

Describe the Bug

Typing of function return as say Integer[500,1000] is not respected. It seems you can return any Integer quite happily.

Expected Behavior

A function signature with a return value in a range should work

function myfunc() >> Integer[5000,80000] {
    return 300
}

This function should always fail however it always returns 300.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a puppet manifest test.pp.
function myfunc() >> Integer[5000,80000] {
    return 300
}

$a = myfunc()
notify{"a is ${a}":}
  1. Run puppet apply file.pp.

This results in:

env PUPPET_VERSION="~>8" bundle exec puppet --version
8.10.0

env PUPPET_VERSION="~>8" bundle exec puppet apply /tmp/test.pp
Notice: Compiled catalog for node.example.org in environment production in 0.01 seconds
Notice: a is 300
Notice: /Stage[main]/Main/Notify[a is 300]/message: defined 'message' as 'a is 300'
Notice: Applied catalog in 0.01 seconds

Environment

  • Version 8.10.0
  • Platform ruby 3.2 rbenv install on RHEL9.

Additional Context

Returning a string does fail since not an integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions