mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Fix mixed tabs and spaces
This commit is contained in:
parent
1f5d8953cd
commit
8c6701111e
1 changed files with 8 additions and 8 deletions
|
@ -14,8 +14,8 @@ A common complaint that we've received was a false-positive error when table wit
|
||||||
--!strict
|
--!strict
|
||||||
type Foo = {x: number | string}
|
type Foo = {x: number | string}
|
||||||
local foos: {Foo} = {
|
local foos: {Foo} = {
|
||||||
{x = 1234567},
|
{x = 1234567},
|
||||||
{x = "hello"} -- Type 'string' could not be converted into 'number'
|
{x = "hello"} -- Type 'string' could not be converted into 'number'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
This case is now handled and skipping optional fields is allowed as well:
|
This case is now handled and skipping optional fields is allowed as well:
|
||||||
|
@ -56,9 +56,9 @@ We no longer report a type error when this method is invoked and we'll also make
|
||||||
local t = { x = 2 }
|
local t = { x = 2 }
|
||||||
|
|
||||||
local x = setmetatable(t, {
|
local x = setmetatable(t, {
|
||||||
__call = function(self, a: number)
|
__call = function(self, a: number)
|
||||||
return a * self.x
|
return a * self.x
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
local a = x(2) -- no longer an error
|
local a = x(2) -- no longer an error
|
||||||
```
|
```
|
||||||
|
@ -90,11 +90,11 @@ table.insert(t, string.find("hello", "h"))
|
||||||
Another new check is 'DuplicateConditions'. The name speaks for itself, `if` statement chains with duplicate conditions and expressions containing `and`/`or` operations with redundant parts will now be detected:
|
Another new check is 'DuplicateConditions'. The name speaks for itself, `if` statement chains with duplicate conditions and expressions containing `and`/`or` operations with redundant parts will now be detected:
|
||||||
```lua
|
```lua
|
||||||
if x then
|
if x then
|
||||||
-- ...
|
-- ...
|
||||||
elseif not x then
|
elseif not x then
|
||||||
-- ...
|
-- ...
|
||||||
elseif x̳ then -- Condition has already been checked on line 1
|
elseif x̳ then -- Condition has already been checked on line 1
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
local success = a and a̳ -- Condition has already been checked on column 17
|
local success = a and a̳ -- Condition has already been checked on column 17
|
||||||
|
|
Loading…
Add table
Reference in a new issue