Skip to content

Commit ad7d2d4

Browse files
authored
Minor fixes for whitespace and typos for migration to the main Julia tree (#104)
* Fix whitespace using Julia contrib/check-whitespace.jl * Fix typos as detected by the rust "typos" tool
1 parent f22ea72 commit ad7d2d4

32 files changed

+44
-63
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ JuliaLowering our representation is the tuple `(name,scope_layer)`, also called
267267
`VarId` in the scope resolution pass.
268268

269269
JuliaLowering's macro expander attaches a unique *scope layer* to each
270-
identifier in a piece of syntax. A "scope layer" is an integer identifer
270+
identifier in a piece of syntax. A "scope layer" is an integer identifier
271271
combined with the module in which the syntax was created.
272272

273273
When expanding macros,
@@ -278,7 +278,7 @@ When expanding macros,
278278
in the syntax produced by the macro are tagged with this layer.
279279

280280
Subsequently, the `(name,scope_layer)` pairs are used when resolving bindings.
281-
This ensures that, by default, we satisfy the basic rules for hygenic macros
281+
This ensures that, by default, we satisfy the basic rules for hygienic macros
282282
discussed in Adams' paper:
283283

284284
1. A macro can't insert a binding that can capture references other than those
@@ -577,7 +577,7 @@ optimizations include:
577577

578578
Properties of non-globals which are computed per-binding-per-closure include:
579579
* Read: the value of the binding is used.
580-
* Write: the binding is asssigned to.
580+
* Write: the binding is assigned to.
581581
* Captured: Bindings defined outside the closure which are either Read or Write
582582
within the closure are "captured" and need to be one of the closure's fields.
583583
* Called: the binding is called as a function, ie, `x()`. (TODO - what is this
@@ -621,7 +621,7 @@ begin
621621
end
622622

623623
let
624-
# f is local so this is a closure becuase `let ... end` introduces a scope
624+
# f is local so this is a closure because `let ... end` introduces a scope
625625
function f()
626626
body
627627
end
@@ -831,7 +831,7 @@ runtime itself.
831831
### Untyped IR (`CodeInfo` form)
832832

833833
The final lowered IR is expressed as `CodeInfo` objects which are a sequence of
834-
`code` statments containing
834+
`code` statements containing
835835
* Literals
836836
* Restricted forms of `Expr` (with semantics different from surface syntax,
837837
even for the same `head`! for example the arguments to `Expr(:call)` in IR
@@ -890,7 +890,7 @@ In the current Julia runtime,
890890
- Uses `jl_toplevel_eval_in` which calls `jl_toplevel_eval_flex`
891891

892892
`jl_toplevel_eval_flex(mod, ex)`
893-
- Lowers if necessay
893+
- Lowers if necessary
894894
- Evaluates certain blessed top level forms
895895
* `:.`
896896
* `:module`

src/ast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ end
168168
# TODO: Replace this with makeleaf variant?
169169
function mapleaf(ctx, src, kind)
170170
ex = makeleaf(syntax_graph(ctx), src, kind)
171-
# TODO: Value coersion might be broken here due to use of `name_val` vs
171+
# TODO: Value coercion might be broken here due to use of `name_val` vs
172172
# `value` vs ... ?
173173
copy_attrs!(ex, src)
174174
ex

src/bindings.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,3 @@ end
247247
function has_lambda_binding(ctx::AbstractLoweringContext, x)
248248
has_lambda_binding(current_lambda_bindings(ctx), x)
249249
end
250-

src/closure_conversion.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ function _convert_closures(ctx::ClosureConversionCtx, ex)
494494
is_closure = kind(name) == K"BindingId" && lookup_binding(ctx, name).kind === :local
495495
cap_rewrite = is_closure ? ctx.closure_infos[name.var_id] : nothing
496496
ctx2 = ClosureConversionCtx(ctx.graph, ctx.bindings, ctx.mod,
497-
ctx.closure_bindings, cap_rewrite, ctx.lambda_bindings,
497+
ctx.closure_bindings, cap_rewrite, ctx.lambda_bindings,
498498
ctx.is_toplevel_seq_point, ctx.toplevel_pure, ctx.toplevel_stmts,
499499
ctx.closure_infos)
500500
body = map_cl_convert(ctx2, ex[2], false)
@@ -520,7 +520,7 @@ function _convert_closures(ctx::ClosureConversionCtx, ex)
520520
capture_rewrites = ClosureInfo(ex #=unused=#, field_syms, field_inds)
521521

522522
ctx2 = ClosureConversionCtx(ctx.graph, ctx.bindings, ctx.mod,
523-
ctx.closure_bindings, capture_rewrites, ctx.lambda_bindings,
523+
ctx.closure_bindings, capture_rewrites, ctx.lambda_bindings,
524524
false, ctx.toplevel_pure, ctx.toplevel_stmts, ctx.closure_infos)
525525

526526
init_closure_args = SyntaxList(ctx)

src/desugaring.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ function similar_tuples_or_identifiers(a, b)
794794
end
795795

796796
# Return the anonymous function taking an iterated value, for use with the
797-
# first agument to `Base.Generator`
797+
# first argument to `Base.Generator`
798798
function func_for_generator(ctx, body, iter_value_destructuring)
799799
if similar_tuples_or_identifiers(iter_value_destructuring, body)
800800
# Use Base.identity for generators which are filters such as
@@ -1139,7 +1139,7 @@ end
11391139
# ncat comes in various layouts which we need to lower to special cases
11401140
# - one dimensional along some dimension
11411141
# - balanced column first or row first
1142-
# - ragged colum first or row first
1142+
# - ragged column first or row first
11431143
function expand_ncat(ctx, ex)
11441144
is_typed = kind(ex) == K"typed_ncat"
11451145
outer_dim = numeric_flags(ex)
@@ -1209,7 +1209,7 @@ function expand_ncat(ctx, ex)
12091209
end
12101210
else
12111211
# For unbalanced/ragged concatenations, the shape is specified by the
1212-
# number of elements in each ND slice of the array, from layout
1212+
# number of elements in each N-dimensional slice of the array, from layout
12131213
# dimension 1 to N. See the documentation for `hvncat` for details.
12141214
i = 1
12151215
while i <= length(nrow_spans)
@@ -1354,7 +1354,7 @@ function expand_assignment(ctx, ex, is_const=false)
13541354
convert_for_type_decl(ctx, ex, rhs, T, true)
13551355
]])
13561356
elseif is_identifier_like(x)
1357-
# Identifer in lhs[1] is a variable type declaration, eg
1357+
# Identifier in lhs[1] is a variable type declaration, eg
13581358
# x::T = rhs
13591359
@ast ctx ex [K"block"
13601360
[K"decl" lhs[1] lhs[2]]
@@ -2378,8 +2378,8 @@ end
23782378
# Select static parameters which are used in function arguments `arg_types`, or
23792379
# transitively used.
23802380
#
2381-
# The transitive usage check probably doesn't guarentee that the types are
2382-
# inferrable during dispatch as they may only be part of the bounds of another
2381+
# The transitive usage check probably doesn't guarantee that the types are
2382+
# inferable during dispatch as they may only be part of the bounds of another
23832383
# type. Thus we might get false positives here but we shouldn't get false
23842384
# negatives.
23852385
function select_used_typevars(arg_types, typevar_names, typevar_stmts)
@@ -3073,7 +3073,7 @@ function expand_function_def(ctx, ex, docs, rewrite_call=identity, rewrite_body=
30733073
push!(sig_stmts, @ast(ctx, ex, [K"curly" "Tuple"::K"core" arg_types[2:i]...]))
30743074
end
30753075
sig_type = @ast ctx ex [K"where"
3076-
[K"curly" "Union"::K"core" sig_stmts...]
3076+
[K"curly" "Union"::K"core" sig_stmts...]
30773077
[K"_typevars" [K"block" typevar_names...] [K"block"]]
30783078
]
30793079
out = @ast ctx docs [K"block"
@@ -3907,7 +3907,7 @@ function rewrite_new_calls(ctx, ex, struct_name, global_struct_name,
39073907
)
39083908
end
39093909

3910-
function _constructor_min_initalized(ex::SyntaxTree)
3910+
function _constructor_min_initialized(ex::SyntaxTree)
39113911
if _is_new_call(ex)
39123912
if any(kind(e) == K"..." for e in ex[2:end])
39133913
# Lowering ensures new with splats always inits all fields
@@ -3917,7 +3917,7 @@ function _constructor_min_initalized(ex::SyntaxTree)
39173917
numchildren(ex) - 1
39183918
end
39193919
elseif !is_leaf(ex)
3920-
minimum((_constructor_min_initalized(e) for e in children(ex)), init=typemax(Int))
3920+
minimum((_constructor_min_initialized(e) for e in children(ex)), init=typemax(Int))
39213921
else
39223922
typemax(Int)
39233923
end
@@ -3958,7 +3958,7 @@ function expand_struct_def(ctx, ex, docs)
39583958
_collect_struct_fields(ctx, field_names, field_types, field_attrs, field_docs,
39593959
inner_defs, children(type_body))
39603960
is_mutable = has_flags(ex, JuliaSyntax.MUTABLE_FLAG)
3961-
min_initialized = minimum((_constructor_min_initalized(e) for e in inner_defs),
3961+
min_initialized = minimum((_constructor_min_initialized(e) for e in inner_defs),
39623962
init=length(field_names))
39633963
newtype_var = ssavar(ctx, ex, "struct_type")
39643964
hasprev = ssavar(ctx, ex, "hasprev")
@@ -3984,7 +3984,7 @@ function expand_struct_def(ctx, ex, docs)
39843984
need_outer_constructor = false
39853985
if isempty(inner_defs) && !isempty(typevar_names)
39863986
# To generate an outer constructor each struct type parameter must be
3987-
# able to be inferred from the list of fields passed as constuctor
3987+
# able to be inferred from the list of fields passed as constructor
39883988
# arguments.
39893989
#
39903990
# More precisely, it must occur in a field type, or in the bounds of a

src/eval.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function finish_ir_debug_info!(current_codelocs_stack)
216216
_compress_debuginfo(only(current_codelocs_stack))
217217
end
218218

219-
# Convert SyntaxTree to the CodeInfo+Expr data stuctures understood by the
219+
# Convert SyntaxTree to the CodeInfo+Expr data structures understood by the
220220
# Julia runtime
221221
function to_code_info(ex::SyntaxTree, slots::Vector{Slot}, meta::CompileHints)
222222
stmts = Any[]

src/kinds.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function _register_kinds()
88
"BEGIN_EXTENSION_KINDS"
99
# atomic fields or accesses (see `@atomic`)
1010
"atomic"
11-
# Flag for @generated parts of a functon
11+
# Flag for @generated parts of a function
1212
"generated"
1313
# Temporary rooting of identifiers (GC.@preserve)
1414
"gc_preserve"

src/linear_ir.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ function _remove_vars_with_isdefined_check!(vars, ex)
890890
end
891891

892892
# Find newvar nodes that are unnecessary because
893-
# 1. The variable is not captured and
893+
# 1. The variable is not captured and
894894
# 2. The variable is assigned before any branches.
895895
#
896896
# This is used to remove newvar nodes that are not needed for re-initializing

src/macro_expansion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ function expand_forms_1(ctx::MacroExpansionContext, ex::SyntaxTree)
395395
@ast ctx ex ex=>K"Placeholder"
396396
elseif is_ccall_or_cglobal(name_str)
397397
# Lower special identifiers `cglobal` and `ccall` to `K"core"`
398-
# psuedo-refs very early so that cglobal and ccall can never be
398+
# pseudo-refs very early so that cglobal and ccall can never be
399399
# turned into normal bindings (eg, assigned to)
400400
@ast ctx ex name_str::K"core"
401401
else

src/runtime.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ function _interpolated_value(ctx::InterpolationContext, srcref, ex)
7373
end
7474
append_sourceref(ctx, ex, srcref)
7575
elseif ex isa Symbol
76-
# Plain symbols become identifiers. This is an accomodation for
76+
# Plain symbols become identifiers. This is an accommodation for
7777
# compatibility to allow `:x` (a Symbol) and `:(x)` (a SyntaxTree) to
78-
# be used interchangably in macros.
78+
# be used interchangeably in macros.
7979
makeleaf(ctx, srcref, K"Identifier", string(ex))
8080
else
8181
makeleaf(ctx, srcref, K"Value", ex)

0 commit comments

Comments
 (0)