Missing validation when casting an argument
See original GitHub issueEnvironment
Name | Version |
---|---|
IDEA version | 2021 |
Luanalysis version | 1.3.0 |
OS | macOS 11.5 |
What are the steps to reproduce this issue?
---@shape shapeA
---@field fieldA string
local variableA = "A"
local function receiveAny(_any)
end
receiveAny(--[[---@type number]] "")
receiveAny(--[[---@type number]] {})
receiveAny(--[[---@type number]] variableA)
receiveAny(--[[---@type shapeA]] variableA)
What happens?
None of the arguments in the receiveAny
executions are validated, everything is accepted.
What were you expecting to happen?
All of the receiveAny
executions should fail.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Argument provided to Rails validate function is sometimes ...
When running certain tests, I would get a validation failure as expected. However, the error is not a RecordInvalid ; instead, it's an ......
Read more >Missing type validation for lists · Issue #2428 - GitHub
I have a resolver that takes a list of enums as an argument, but when i send something other than that enum ir...
Read more >Request Handling — Connexion 2.0 documentation
Request Validation Both the request body and parameters are validated against the specification, using jsonschema. If the request doesn't match the ...
Read more >Verifying the user's response | reCAPTCHA | Google Developers
This page explains how to verify a user's response to a reCAPTCHA challenge from your application's backend. For web users, you can get...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
The first argument passed to the make method is the data under validation. The second argument is an array of the validation rules...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! I was aware of the
.def.lua
files indeed, used them to map out the parts of the Solar2D engine I use ^^ However I’m not a fan of adding game-specific shapes to that definition file, hence I’m more in favour of writing a wrapper 😃Assuming the external library doesn’t already have types, you can provide your own types for the library. Here’s an example for Tabletop Simulator:
https://github.com/Benjamin-Dobell/tts-types/tree/master/tts
Those
.def.lua
files provide Lua definitions for functions/tables/userdata which are (mostly) implemented in C#. However, the same process ought to work for regular Lua libraries. Basically anywhere in your IntelliJ project you can provide a<module name>.def.lua
file that provides types. The only thing special about the.def.lua
extension is that irrelevant inspections are disabled.