Skip to content
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

Typechecker isSubtype does not handle alias type #403

Closed
Mark1626 opened this issue Jan 8, 2024 · 0 comments
Closed

Typechecker isSubtype does not handle alias type #403

Mark1626 opened this issue Jan 8, 2024 · 0 comments

Comments

@Mark1626
Copy link
Collaborator

Mark1626 commented Jan 8, 2024

https://github.com/cucapra/dahlia/blob/master/src/main/scala/typechecker/Subtyping.scala#L44-L48

The following results in an error from the type checker

Case 1

record point { x: bit<32> }
def f(p: point): point = {
    let nextp: point = { x=p.x + 1 };
    return nextp;
}
Expected subtype of point in return, received: point

In this case areEqual receives the variable np as type TRecType while the return type is considered as TAlias.


Case 2

record point { x: ubit<32> }
let a: point = {x=10};
let b: point = (a as point);

The opposite scenario, areEqual receives TAlias for t1 and TRecType for t2.

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

No branches or pull requests

2 participants