Skip to content

type-signature functions don't understand Value correctly #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
braxtonmckee opened this issue Jan 30, 2023 · 0 comments
Open

type-signature functions don't understand Value correctly #422

braxtonmckee opened this issue Jan 30, 2023 · 0 comments
Labels

Comments

@braxtonmckee
Copy link
Collaborator

I want this to work correctly, but it doesn't:

    def test_function_signature_with_type_argument(self):
        def castToType(X, T):
            return T.Value

        @Entrypoint
        def castTo(x, T) -> castToType:
            return T(x)

        assert castTo.resultTypeFor(int, Value(str)).typeRepresentation is str

        assert castTo(10, str) == "10"

The problem is that the compiler casts the value 'str' to 'type', instead of using Value(str). Of course, fixing this means that we have to always pass a Value for a type instead of 'type' for any argument which is a type. This is perhaps more specific than what we want in some cases.

To fix this, we may need to add some additional control to the type-signature allowing us to specify what level of detail the compiler (and also interpreter) should assume for a given argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant