Skip to content

Strange Z# inference behavior #234

@cmlsharp

Description

@cmlsharp
def bar<N>(field[N] x) -> bool:
    return N == 100
    
def foo(field[200] x) -> bool:
    return bar(x)

def main(private field[100] x) -> bool:
    return foo(x)

You would think calling foo from main would be a type error (and that's probably the right fix here), but failing that, you would think that the call to bar(x) inside foo would be equivalent to bar::<200>(x), but actually x "remembers" its "real" type and bar::<100>() is inferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions