Created
October 18, 2015 06:42
-
-
Save gmpreussner/42316c11c9c6d4479d21 to your computer and use it in GitHub Desktop.
Bug with generics/concepts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Foo[T] = concept x, y | |
foo(x, y) is bool | |
Bar[T] = object | |
b: T | |
when true: # the following works | |
proc foo(x, y: Bar): bool = true | |
when false: # this does not (unit test fails) | |
proc foo(x, y: Bar): bool = x.b < y.b | |
when false: # workaround | |
proc foo(x, y: Bar): bool = result = x.b < y.b | |
test "foo": | |
check(Bar[int] is Foo[int]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure if this is a problem with concepts, generics, or type inference, or a combination of those.