diff options
author | andri lim <jangko128@gmail.com> | 2018-04-27 13:53:20 +0700 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-27 08:53:20 +0200 |
commit | e4aa140d22fe065bee78a1edaadbd5bae3160779 (patch) | |
tree | dd9b45342551283254b2a08d2cc89064348fabb5 /tests | |
parent | 397e1731393be598991df302006ec3634baa3583 (diff) | |
download | Nim-e4aa140d22fe065bee78a1edaadbd5bae3160779.tar.gz |
fixes #7600, generic object with generic ref object parent typerel bug (#7678)
* fixes #7600 * fix wrong logic
Diffstat (limited to 'tests')
-rw-r--r-- | tests/typerel/t7600_1.nim | 18 | ||||
-rw-r--r-- | tests/typerel/t7600_2.nim | 17 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/typerel/t7600_1.nim b/tests/typerel/t7600_1.nim new file mode 100644 index 000000000..e3a5fefa2 --- /dev/null +++ b/tests/typerel/t7600_1.nim @@ -0,0 +1,18 @@ +discard """ +errormsg: "type mismatch: got <Thin[system.int]>" +nimout: '''t7600_1.nim(18, 6) Error: type mismatch: got <Thin[system.int]> +but expected one of: +proc test[T](x: Paper[T]) + +expression: test tn''' +""" + +type + Paper[T] = ref object of RootObj + thickness: T + Thin[T] = object of Paper[T] + +proc test[T](x: Paper[T]) = discard + +var tn = Thin[int]() +test tn diff --git a/tests/typerel/t7600_2.nim b/tests/typerel/t7600_2.nim new file mode 100644 index 000000000..7badb69cf --- /dev/null +++ b/tests/typerel/t7600_2.nim @@ -0,0 +1,17 @@ +discard """ +errormsg: "type mismatch: got <Thin>" +nimout: '''t7600_2.nim(17, 6) Error: type mismatch: got <Thin> +but expected one of: +proc test(x: Paper) + +expression: test tn''' +""" + +type + Paper = ref object of RootObj + Thin = object of Paper + +proc test(x: Paper) = discard + +var tn = Thin() +test tn |