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

Typechecking issue, might be related to modules #127

Closed
kaeluka opened this issue Apr 18, 2015 · 4 comments
Closed

Typechecking issue, might be related to modules #127

kaeluka opened this issue Apr 18, 2015 · 4 comments
Assignees

Comments

@kaeluka
Copy link
Contributor

kaeluka commented Apr 18, 2015

Following two files in the same directory:

main.enc:

#! /usr/bin/env encorec -run

import Vector

class Main
  def main() : void {
    (new Vector<int>).there();
    print "hello"
  }

Vector.enc:

passive class Vector<t> {
  data : [t]

  def init() : void {
    let b = new [int](3) in {
        b[0] = 0;
        b[1] = 0;
        b[2] = 42 - 19;
    }
  }

  def there() : void
    print "vector reporting for duty!"
}

If I run encorec -tc Vector.enc, the typecheck passes, but if I run encorec -tc main.enc, I get:

... $ encorec -tc main.enc
Importing module Vector from ./Vector.enc
encorec: Cannot typecheck expression new [int](3)

The expression seems to typecheck fine when I typecheck the file on its own, but not when it's imported.

@supercooldave
Copy link

Challenge accepted.
I'll turn this one and Kiko's into test cases and resolve the bugs.

@supercooldave supercooldave self-assigned this Apr 18, 2015
@supercooldave
Copy link

It seems that the problem is related to desugaring and modules.
It seems that imported modules are not desugarred before type checking.
Should be an easy fix.

@supercooldave
Copy link

Yep. Just one little line of code in the right place.

@supercooldave
Copy link

Now. I need to work out how to check in without it costing me cake.

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