Mercurial > vim
comparison src/vim9compile.c @ 25263:5861cc1f5704 v8.2.3168
patch 8.2.3168: Vim9: type error for constant of type any
Commit: https://github.com/vim/vim/commit/378697ac58b8f9705286e36d1805a052e96fb86e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 15 19:23:18 2021 +0200
patch 8.2.3168: Vim9: type error for constant of type any
Problem: Vim9: type error for constant of type any.
Solution: Do add a runtime type check if a constant has type any.
(closes #8570)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 15 Jul 2021 19:30:04 +0200 |
parents | 205a0126ac2d |
children | 84d5cda23b34 |
comparison
equal
deleted
inserted
replaced
25262:e9065d299e9b | 25263:5861cc1f5704 |
---|---|
1049 if (check_type(expected, actual, FALSE, where) == OK) | 1049 if (check_type(expected, actual, FALSE, where) == OK) |
1050 return OK; | 1050 return OK; |
1051 | 1051 |
1052 // If the actual type can be the expected type add a runtime check. | 1052 // If the actual type can be the expected type add a runtime check. |
1053 // If it's a constant a runtime check makes no sense. | 1053 // If it's a constant a runtime check makes no sense. |
1054 if (!actual_is_const && use_typecheck(actual, expected)) | 1054 if ((!actual_is_const || actual == &t_any) |
1055 && use_typecheck(actual, expected)) | |
1055 { | 1056 { |
1056 generate_TYPECHECK(cctx, expected, offset, arg_idx); | 1057 generate_TYPECHECK(cctx, expected, offset, arg_idx); |
1057 return OK; | 1058 return OK; |
1058 } | 1059 } |
1059 | 1060 |