Skip to content

Commit 07c660a

Browse files
authored
Merge pull request #5 from JunoLab/avi/inferrability
improve inferrability, add inferrability regression test, and switch to gh actions
2 parents 65cd848 + 4ddf474 commit 07c660a

File tree

4 files changed

+77
-23
lines changed

4 files changed

+77
-23
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
test:
9+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
10+
runs-on: ${{ matrix.os }}
11+
continue-on-error: ${{ matrix.allow-failure }}
12+
strategy:
13+
fail-fast: false # don't stop CI even when one of them fails
14+
matrix:
15+
version:
16+
- '1.5' # current stable
17+
- '1.0' # lts
18+
os:
19+
- ubuntu-latest
20+
- macOS-latest
21+
- windows-latest
22+
arch:
23+
- x64
24+
- x86
25+
allow-failure: [false]
26+
include:
27+
# this is so verbose... any other way to simplify this ?
28+
- version: 'nightly'
29+
os: ubuntu-latest
30+
arch: x64
31+
allow-failure: true
32+
- version: 'nightly'
33+
os: ubuntu-latest
34+
arch: x86
35+
allow-failure: true
36+
- version: 'nightly'
37+
os: macOS-latest
38+
arch: x64
39+
allow-failure: true
40+
- version: 'nightly'
41+
os: windows-latest
42+
arch: x64
43+
allow-failure: true
44+
- version: 'nightly'
45+
os: windows-latest
46+
arch: x86
47+
allow-failure: true
48+
exclude:
49+
- os: macOS-latest
50+
arch: x86
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: julia-actions/setup-julia@v1
54+
with:
55+
version: ${{ matrix.version }}
56+
arch: ${{ matrix.arch }}
57+
- uses: julia-actions/julia-buildpkg@latest
58+
- uses: julia-actions/julia-runtest@latest
59+
- uses: julia-actions/julia-processcoverage@v1
60+
- uses: codecov/codecov-action@v1
61+
with:
62+
file: ./lcov.info
63+
flags: unittests
64+
name: codecov-umbrella
65+
fail_ci_if_error: false
66+
token: ${{ secrets.CODECOV_TOKEN }}

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/FuzzyCompletions.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ function bslash_completions(string, pos)
591591
return (false, (Completion[], 0:-1, false))
592592
end
593593

594-
function dict_identifier_key(str, tag, context_module)
594+
function dict_identifier_key(str, tag, context_module = Main)
595595
if tag === :string
596596
str_close = str*"\""
597597
elseif tag === :cmd
@@ -670,7 +670,7 @@ function completions(string, pos, context_module = Main)
670670
# if completing a key in a Dict
671671
identifier, partial_key, loc = dict_identifier_key(partial,inc_tag, context_module)
672672
if identifier !== nothing
673-
matches = find_dict_matches(identifier)
673+
matches = find_dict_matches(identifier)::Vector{String}
674674
length(matches)==1 && (lastindex(string) <= pos || string[nextind(string,pos)] != ']') && (matches[1]*=']')
675675
if length(matches)>0
676676
suggestions = Completion[DictCompletion(identifier, match, partial_key) for match in matches]
@@ -714,9 +714,12 @@ function completions(string, pos, context_module = Main)
714714
ex = Meta.parse(s * ")", raise=false, depwarn=false)
715715

716716
if isa(ex, Expr)
717-
if ex.head==:call
717+
if ex.head === :call
718718
return complete_methods(ex, context_module), first(frange):method_name_end, false
719-
elseif ex.head==:. && ex.args[2] isa Expr && ex.args[2].head==:tuple
719+
elseif ex.head === :. && begin
720+
x = ex.args[2]
721+
isa(x, Expr) && x.head === :tuple
722+
end
720723
return complete_methods(ex, context_module), first(frange):(method_name_end - 1), false
721724
end
722725
end

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ end
9090
@test comp("Nothing") == "Nothing"
9191
@test comp("Mis") == "Missing"
9292
end
93+
94+
@testset "inferrability" begin
95+
@inferred FuzzyCompletions.completions("foo", lastindex("foo"), @__MODULE__)
96+
end

0 commit comments

Comments
 (0)