-
-
Save barcharcraz/6b9bcfc874334de2c914 to your computer and use it in GitHub Desktop.
should it comple?
This file contains hidden or 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
| import macros | |
| type int1 = distinct int | |
| type int2 = distinct int | |
| proc take[T](value: int1) = | |
| when T is int2: | |
| static: error("killed in take(int1)") | |
| proc take[T](vale: int2) = | |
| when T is int1: | |
| static: error("killed in take(int2)") | |
| var i1: int1 = 1.int1 | |
| var i2: int2 = 2.int2 | |
| static: hint("compile take[int1](i1)") | |
| take[int1](i1) | |
| static: hint("compile take[int2](i2)") | |
| take[int2](i2) | |
| fails with error | |
| overload.nim(13, 12) Hint: compile take[int1](i1) [User] | |
| stack trace: (most recent call last) | |
| overload.nim(9) take | |
| overload.nim(14, 4) Info: instantiation from here | |
| overload.nim(9, 17) Error: killed in take(int2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment