Skip to content

Commit

Permalink
Fixed error shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
nightcycle committed Jul 27, 2023
1 parent 1cf9369 commit ed4907a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,11 @@ jobs:

# Test validity
- name: typecheck src files
run: luau-lsp analyze src --sourcemap=sourcemap.json --ignore="Packages/**" --ignore="**/Packages/**" --ignore="*.spec.luau" --ignore="out/**" --flag:LuauTypeInferIterationLimit=0 --flag:LuauCheckRecursionLimit=0 --flag:LuauTypeInferRecursionLimit=0 --flag:LuauTarjanChildLimit=0 --flag:LuauTypeInferTypePackLoopLimit=0 --flag:LuauVisitRecursionLimit=0 --definitions=types/globalTypes.d.lua --flag:LuauParseDeclareClassIndexer=true
run: luau-lsp analyze src --sourcemap=sourcemap.json --ignore="Packages/**" --ignore="**/Packages/**" --ignore="*.spec.luau" --flag:LuauTypeInferIterationLimit=0 --flag:LuauCheckRecursionLimit=0 --flag:LuauTypeInferRecursionLimit=0 --flag:LuauTarjanChildLimit=0 --flag:LuauTypeInferTypePackLoopLimit=0 --flag:LuauVisitRecursionLimit=0 --definitions=types/globalTypes.d.lua --flag:LuauParseDeclareClassIndexer=true

- name: lint src files
run: selene src

- name: lint built files
run: selene out

- name: Update version and labels
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/selene.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
content_dir_path=$1
selene $content_dir_path > tests/selene/$content_dir_path.txt
error_count=$(grep -o -w "error" "tests/selene/${content_dir_path}.txt" | wc -l)
warn_count=$(grep -o -w "warn" "tests/selene/${content_dir_path}.txt" | wc -l)
warn_count=$(grep -o -w "warning" "tests/selene/${content_dir_path}.txt" | wc -l)
echo "${content_dir_path} selene errors: ${error_count}, warnings: ${warn_count}"
6 changes: 3 additions & 3 deletions src/Button/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function Constructor(config: ButtonParameters): Button
end))

-- construct sub-instances
local TextLabel = TextLabel(maid)({
local ButtonTextLabel = TextLabel(maid)({
BackgroundTransparency = 1,
TextTransparency = TextTransparency,
ZIndex = 2,
Expand All @@ -213,7 +213,7 @@ function Constructor(config: ButtonParameters): Button
Position = UDim2.fromScale(0.5, 0.5),
})
maid:GiveTask(RunService.RenderStepped:Connect(function(deltaTime: number)
LabelAbsoluteSize:Set(TextLabel.AbsoluteSize)
LabelAbsoluteSize:Set(ButtonTextLabel.AbsoluteSize)
end))

local TextButton: TextButton = _fuse.new("TextButton")({
Expand Down Expand Up @@ -393,7 +393,7 @@ function Constructor(config: ButtonParameters): Button
end, IsHovering, IsSelected, IsRippling, ActiveBackgroundColor, ActiveFillColor, TimeKeys),
}),
TextButton,
TextLabel,
ButtonTextLabel,
} :: { Instance },
}
config.BorderTransparency = nil
Expand Down
20 changes: 10 additions & 10 deletions src/Util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,44 @@ type Signal = Signal.Signal
local Util = {}
Util.__index = Util

function Util.cleanUpPrep(Maid: Maid, inst: Instance)
function Util.cleanUpPrep(maid: Maid, inst: Instance)
local compMaid = Maid.new()
compMaid:GiveTask(inst)
for i, desc in ipairs(inst:GetDescendants()) do
compMaid:GiveTask(desc)
end

Maid:GiveTask(compMaid)
maid:GiveTask(compMaid)

Maid:GiveTask(inst.Destroying:Connect(function()
maid:GiveTask(inst.Destroying:Connect(function()
compMaid:Destroy()
Maid:Destroy()
maid:Destroy()
end))
end

function Util.bindFunction<F>(inst: Instance, Maid: Maid, name: string, func: F): BindableFunction & { OnInvoke: F }
function Util.bindFunction<F>(inst: Instance, maid: Maid, name: string, func: F): BindableFunction & { OnInvoke: F }
assert(typeof(func) == "function")
local bindableFunction = Instance.new("BindableFunction")
bindableFunction.Name = name
bindableFunction.OnInvoke = func
Maid:GiveTask(bindableFunction)
maid:GiveTask(bindableFunction)
bindableFunction.Parent = inst

local bFunc: any = bindableFunction
return bFunc
end

function Util.bindSignal(inst: Instance, Maid: Maid, name: string, Signal: Signal): BindableEvent
function Util.bindSignal(inst: Instance, maid: Maid, name: string, signal: Signal): BindableEvent
local bindableEvent = Instance.new("BindableEvent")
bindableEvent.Name = name

-- Maid:GiveTask(bindableEvent.Event:Connect(function(...)
-- Signal:Fire(...)
-- signal:Fire(...)
-- end))
Maid:GiveTask(Signal:Connect(function(...)
maid:GiveTask(Signal:Connect(function(...)
bindableEvent:Fire(...)
end))
Maid:GiveTask(bindableEvent)
maid:GiveTask(bindableEvent)
bindableEvent.Parent = inst

return bindableEvent
Expand Down
34 changes: 17 additions & 17 deletions src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export type Synthetic = (
& ((className: "BillboardFrame") -> (BillboardFrameParameters) -> BillboardFrame.BillboardFrame)
)

return function(Maid: Maid?): Synthetic
return function(maid: Maid?): Synthetic
return function(className: any): any
assert(
className == "TextLabel"
Expand All @@ -99,37 +99,37 @@ return function(Maid: Maid?): Synthetic
or className == "BillboardFrame"
)
if className == "TextLabel" then
return TextLabel(Maid)
return TextLabel(maid)
elseif className == "ViewportMountFrame" then
return ViewportMountFrame(Maid)
return ViewportMountFrame(maid)
elseif className == "TextField" then
return TextField(Maid)
return TextField(maid)
elseif className == "Switch" then
return Switch(Maid)
return Switch(maid)
elseif className == "SurfaceFrame" then
return SurfaceFrame(Maid)
return SurfaceFrame(maid)
elseif className == "Slider" then
return Slider(Maid)
return Slider(maid)
elseif className == "RadioButton" then
return RadioButton(Maid)
return RadioButton(maid)
elseif className == "IconLabel" then
return IconLabel(Maid)
return IconLabel(maid)
elseif className == "Hint" then
return Hint(Maid)
return Hint(maid)
elseif className == "EffectGui" then
return EffectGui(Maid)
return EffectGui(maid)
elseif className == "Checkbox" then
return Checkbox(Maid)
return Checkbox(maid)
elseif className == "Button" then
return Button(Maid)
return Button(maid)
elseif className == "Bubble" then
return Bubble(Maid)
return Bubble(maid)
elseif className == "BoundingBoxFrame" then
return BoundingBoxFrame(Maid)
return BoundingBoxFrame(maid)
elseif className == "BoardFrame" then
return BoardFrame(Maid)
return BoardFrame(maid)
elseif className == "BillboardFrame" then
return BillboardFrame(Maid)
return BillboardFrame(maid)
end
return nil
end
Expand Down

0 comments on commit ed4907a

Please sign in to comment.