Skip to content

Typechecker mistakenly reports type error for well-typed program with generic ADT #2867

Description

@sungshik

Describe the bug

The following test mistakenly fails (i.e., the typechecker reports a type error, but the program is well-typed):

test bool falsePositive() = checkModuleOK("
    module FalsePositive /**/
        data D[&T] = d(&T n);
        int f() {
            n1 = d(5).n;
            n2 = n1;
            n3 = n2;
            return n3 + 5;
        }
    ");

// Typechecker reports type error: "Addition not defined on `&T` and `int`"

The " /**/" is needed to force Typepal to schedule calcs/reqs in a particular order. Without it, the test succeeds.

To Reproduce

Run the test. See also: #2869.

Expected behavior

The test should succeed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions