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

record static value parameter gets unwrapped #494

Open
stepancheg opened this issue Apr 2, 2013 · 0 comments
Open

record static value parameter gets unwrapped #494

stepancheg opened this issue Apr 2, 2013 · 0 comments

Comments

@stepancheg
Copy link
Collaborator

Code:

record Foo[A] (
    a: Type(A),
);

main() {
    var foo = Foo[#1]();
    if (foo.a != #1) // <-- compilation fails at this line
        return 1;
    if (Type(foo.a) != Type(#1))
        return 2;
    return 0;
}

Compilation fails with message:

###############################
}

forceinline default (!=)(a, b) : Bool = not (==)(a, b);
------------------------------------------------^

define ordered?;
###############################
/Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/operators/operators.clay(133,48): error: no matching overload found
... skippped
    65 universal overloads not shown (show with -full-match-errors option)

compilation context:
    ==(Int32, Static[1])
  /Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/operators/operators.clay(133,48):
    !=(Int32, Static[1])
  /Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/operators/operators.clay(432,18):
    infixOperator(Int32, Static[!=], Static[1])
  lang/records/params/static-int-param/test.clay(7,14):
    main()
  /Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/system/system.clay(23,30):
    getExitCode(Int32)
  /Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/system/system.clay(23,26):
    runMain(Int32, Pointer[Pointer[Int8]], Static[main])
  /Users/yozh/devel/left/clay/build/compiler/../../lib-clay/core/system/system.clay(39,13):
    callMain(Static[main], Int32, Pointer[Pointer[Int8]])
    external main

It means that foo.a has type Int32, but type of foo.a should be Static[1], because record type parameter is #1.

Similar code with 1, not #1 parameter works properly, see commit e6488ff.

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

1 participant