Skip to content

Commit 9c99fef

Browse files
krame505quark17
authored andcommitted
Fix to avoid extra _ in deepSplitPortNames/shallowSplitPortNames when base is empty
1 parent 1f0a078 commit 9c99fef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Libraries/Base1/SplitPorts.bs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ instance (ShallowSplitPorts' r p) => ShallowSplitPorts' (Meta (MetaField name id
6969
shallowUnsplitPorts' = Meta ∘ shallowUnsplitPorts'
7070
shallowSplitPortNames' _ base = shallowSplitPortNames' (_ :: r) $
7171
-- Avoid an extra underscore, since data fields names are _[0-9]+
72-
if stringOf name == "" || stringHead (stringOf name) == '_'
72+
if base == "" || stringOf name == "" || stringHead (stringOf name) == '_'
7373
then base +++ stringOf name
7474
else base +++ "_" +++ stringOf name
7575

@@ -180,7 +180,7 @@ instance (DeepSplitPorts'' r p) => DeepSplitPorts'' (Meta (MetaField name idx) r
180180
deepUnsplitPorts'' = Meta ∘ deepUnsplitPorts''
181181
deepSplitPortNames'' _ base = deepSplitPortNames'' (_ :: r) $
182182
-- Avoid an extra underscore, since data fields names are _[0-9]+
183-
if stringOf name == "" || stringHead (stringOf name) == '_'
183+
if base == "" || stringOf name == "" || stringHead (stringOf name) == '_'
184184
then base +++ stringOf name
185185
else base +++ "_" +++ stringOf name
186186

0 commit comments

Comments
 (0)