Skip to content

Commit

Permalink
Fix spelling errors (2) (#9854)
Browse files Browse the repository at this point in the history
Similar to fixes done in #9844.
  • Loading branch information
docelic committed Oct 30, 2020
1 parent d44530d commit 899ca63
Show file tree
Hide file tree
Showing 31 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions src/array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class Array(T)
#
# See also: `#uniq`.
def |(other : Array(U)) forall U
# Heurisitic: if the combined size is small we just do a linear scan
# Heuristic: if the combined size is small we just do a linear scan
# instead of using a Hash for lookup.
if size + other.size <= SMALL_ARRAY_SIZE
ary = Array(T | U).new
Expand Down Expand Up @@ -300,7 +300,7 @@ class Array(T)
# [1, 2, 3] - [2, 1] # => [3]
# ```
def -(other : Array(U)) forall U
# Heurisitic: if any of the arrays is small we just do a linear scan
# Heuristic: if any of the arrays is small we just do a linear scan
# instead of using a Hash for lookup.
if size <= SMALL_ARRAY_SIZE || other.size <= SMALL_ARRAY_SIZE
ary = Array(T).new
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/ast.cr
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module Crystal
end

private def compute_c_calling_convention
# One case where this is not true if for LLVM instrinsics.
# One case where this is not true if for LLVM intrinsics.
# For example overflow intrinsics return a tuple, like {i32, i1}:
# in C ABI that is represented as i64, but we need to keep the original
# type here, respecting LLVM types, not the C ABI.
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/call.cr
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Crystal::CodeGenVisitor
obj = node.obj

# Always accept obj: even if it's not passed as self this might
# involve intermerdiate calls with side effects.
# involve intermediate calls with side effects.
if obj
@needs_value = true
accept obj
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/debug.cr
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ module Crystal
when LLVM::Value then value
when LLVM::Function then value.to_value
when Nil then LLVM::Value.null
else raise "Unsuported value type: #{value.class}"
else raise "Unsupported value type: #{value.class}"
end
end
llvm_context.md_node(values)
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/codegen/llvm_typer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,15 @@ module Crystal
end

# Copy existing LLVM types, possibly from another context,
# into this typer's context.
# into this type's context.
def copy_types(types : Array(LLVM::Type))
types.map do |type|
copy_type(type).as(LLVM::Type)
end
end

# Copy an existing LLVM type, possibly from another context,
# into this typer's context.
# into this type's context.
def copy_type(type : LLVM::Type)
case type.kind
when .void?
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module Crystal
property? no_cleanup = false

# If `true`, no executable will be generated after compilation
# (useful to type-check a prorgam)
# (useful to type-check a program)
property? no_codegen = false

# Maximum number of LLVM modules that are compiled in parallel
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# require "compiler/crystal/formatter"
# ```
#
# and use Crystal's formatter programatically, without
# and use Crystal's formatter programmatically, without
# requiring all the semantic and codegen code.

require "./tools/formatter"
2 changes: 1 addition & 1 deletion src/compiler/crystal/program.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Crystal
# around in every step of a compilation to record and query this information.
#
# In a way, a Program is an alternative implementation to having global variables
# for all of this data, but modelled this way one can easily test and exercise
# for all of this data, but modeled this way one can easily test and exercise
# programs because each one has its own definition of the types created,
# methods instantiated, etc.
#
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/ast.cr
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ module Crystal
end
end

# Ficticious node to mean a location in code shouldn't be reached.
# Fictitious node to mean a location in code shouldn't be reached.
# This is used in the implicit `else` branch of a case.
class Unreachable < ASTNode
def clone_without_location
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/call.cr
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ class Crystal::Call
output = block_arg_restriction.output
elsif block_arg_restriction
# Otherwise, the block spec could be something like &block : Foo, and that
# is valid too only if Foo is an alias/typedef that referes to a FunctionType
# is valid too only if Foo is an alias/typedef that refers to a FunctionType
block_arg_restriction_type = lookup_node_type(match.context, block_arg_restriction).remove_typedef
unless block_arg_restriction_type.is_a?(ProcInstanceType)
block_arg_restriction.raise "expected block type to be a function type, not #{block_arg_restriction_type}"
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/cleanup_transformer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ module Crystal
end
end

# Check if the block has its type freezed and it doesn't match the current type
# Check if the block has its type frozen and it doesn't match the current type
if block && (freeze_type = block.freeze_type) && (block_type = block.type?)
unless block_type.implements?(freeze_type)
freeze_type = freeze_type.base_type if freeze_type.is_a?(VirtualType)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/method_lookup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ module Crystal
matched_named_arg_types ||= [] of NamedArgumentType
matched_named_arg_types << NamedArgumentType.new(named_arg.name, match_arg_type)
else
# If there's a double splat it's ok, the named arg will be put there
# If there's a double splat it's OK, the named arg will be put there
if a_def.double_splat
match_arg_type = named_arg.type

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/new.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Crystal
define_default_new(file_module)
end

# Once we are done with the expansions we mark `initialze` methods
# Once we are done with the expansions we mark `initialize` methods
# without an explicit visibility as `protected`.
new_expansions.each do |expansion|
original = expansion[:original]
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/type_guess_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module Crystal
end

def visit(node : Var)
# Check for an argument that mathces this var, and see
# Check for an argument that matches this var, and see
# if it has a default value. If so, we do a `self` check
# to make sure `self` isn't used
if (arg = args_hash[node.name]?) && (default_value = arg.default_value)
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/syntax/ast.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module Crystal
end

# Returns the doc comment attached to this node. Not every node
# supports having doc domments, so by default this returns `nil`.
# supports having doc comments, so by default this returns `nil`.
def doc
end

Expand Down Expand Up @@ -97,7 +97,7 @@ module Crystal
end

# It yields `nil` always.
# (It is overrided by `Expressions` to implement `#single_expression`.)
# (It is overriden by `Expressions` to implement `#single_expression`.)
def single_expression?
nil
end
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ module Crystal
end
skip_statement_end

body = push_visbility { parse_expressions }
body = push_visibility { parse_expressions }

end_location = token_end_location
check_ident :end
Expand Down Expand Up @@ -1703,7 +1703,7 @@ module Crystal
type_vars, splat_index = parse_type_vars
skip_statement_end

body = push_visbility { parse_expressions }
body = push_visibility { parse_expressions }

end_location = token_end_location
check_ident :end
Expand Down Expand Up @@ -5358,7 +5358,7 @@ module Crystal
name_location = @token.location
next_token_skip_statement_end

body = push_visbility { parse_lib_body_expressions }
body = push_visibility { parse_lib_body_expressions }

check_ident :end
end_location = token_end_location
Expand Down Expand Up @@ -6041,7 +6041,7 @@ module Crystal
name == "self" || @def_vars.last.includes?(name)
end

def push_visbility
def push_visibility
old_visibility = @visibility
@visibility = nil
value = yield
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ module Crystal

# If we are formatting macro contents, if there are nested macro
# control structures they are definitely escaped with `\`,
# because otherwise we wouln't be able to format the contents.
# because otherwise we wouldn't be able to format the contents.
# So here we append those slashes. In theory the nesting can be
# very deep but it's usually just one level.
private def write_macro_slashes
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/crystal/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module Crystal
# Returns the type that owns class vars for a type.
#
# This method returns self, but subclasses might override.
# For example, a metaclass's class_var_owner is the instance type.
# For example, a metaclass' class_var_owner is the instance type.
def class_var_owner
self
end
Expand Down Expand Up @@ -2059,7 +2059,7 @@ module Crystal
getter(metaclass) { GenericClassInstanceMetaclassType.new(self.program, self) }
end

# An instantiated genric module, like Enumerable(Int32).
# An instantiated generic module, like Enumerable(Int32).
class GenericModuleInstanceType < GenericInstanceType
include InstanceVarContainer
include InstanceVarInitializerContainer
Expand Down Expand Up @@ -2668,7 +2668,7 @@ module Crystal

# An instantiated enum type.
#
# TODO: right now this is not properly modelled. Ideally there
# TODO: right now this is not properly modeled. Ideally there
# should be EnumType and EnumInstanceType, where EnumType would
# be `Enum(T)` and given:
#
Expand Down
2 changes: 1 addition & 1 deletion src/csv.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# A CSV instance holds a cursor to the current row in the CSV. The cursor
# is advanced by invoking `#next`, which returns `true` if a next row was found,
# and `false` otherwise. A first call to `#next` is required to position the
# csv parser in the first row.
# CSV parser in the first row.
#
# Once positioned in a row, values can be obtained with the several `#[]` methods,
# which can accept a header name, column position, or header name pattern as a `Regex`.
Expand Down
2 changes: 1 addition & 1 deletion src/fiber/context/aarch64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Fiber
ldr x19, [$1, #0] // sp = new_context.stack_top (x19)
mov sp, x19
ldp x0, x1, [sp, #20*8] // pop 1st argument (+ alignement)
ldp x0, x1, [sp, #20*8] // pop 1st argument (+ alignment)
ldp x20, x19, [sp, #18*8]
ldp x22, x21, [sp, #16*8]
ldp x24, x23, [sp, #14*8]
Expand Down
4 changes: 2 additions & 2 deletions src/hash.cr
Original file line number Diff line number Diff line change
Expand Up @@ -662,14 +662,14 @@ class Hash(K, V)
end

# Initializes `@entries` for a dup copy.
# Here we only need tu duplicate the buffer.
# Here we only need to duplicate the buffer.
private def initialize_dup_entries(other)
return if other.@entries.null?

@entries = malloc_entries(other.entries_capacity)

# Note that we only need to copy `entries_size` which
# are the effectives entries in use.
# are the effective entries in use.
@entries.copy_from(other.@entries, other.entries_size)
end

Expand Down
2 changes: 1 addition & 1 deletion src/log/metadata.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Log::Metadata
# How many entries are potentially overriden from parent (ie: initial entries.size)
@overriden_size = uninitialized Int32
# How many entries are stored from @first.
# Initially are @overriden_size, the one explictly overriden in entries argument.
# Initially are @overriden_size, the one explicitly overriden in entries argument.
# When the metadata is defragmented @size will be increased up to
# the actual number of entries resulting from merging the parent
@size = uninitialized Int32
Expand Down
2 changes: 1 addition & 1 deletion src/mime/media_type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ module MIME
end
end

# TODO: Using a different datastructure than `Hash` for storing
# TODO: Using a different data structure than `Hash` for storing
# continuation sections could improve performance.
normalized_key = "#{base_key}*#{section}"
continuation_map = continuation[base_key]
Expand Down
2 changes: 1 addition & 1 deletion src/number.cr
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ struct Number
self > other ? 1 : (self < other ? -1 : 0)
end

# Keeps *digits* significants digits of this number in the given *base*.
# Keeps *digits* significant digits of this number in the given *base*.
#
# ```
# 1234.567.significant(1) # => 1000
Expand Down
6 changes: 3 additions & 3 deletions src/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ class Process
@process_info.pid.to_i64
end

# A pipe to this process's input. Raises if a pipe wasn't asked when creating the process.
# A pipe to this process' input. Raises if a pipe wasn't asked when creating the process.
getter! input : IO::FileDescriptor

# A pipe to this process's output. Raises if a pipe wasn't asked when creating the process.
# A pipe to this process' output. Raises if a pipe wasn't asked when creating the process.
getter! output : IO::FileDescriptor

# A pipe to this process's error. Raises if a pipe wasn't asked when creating the process.
# A pipe to this process' error. Raises if a pipe wasn't asked when creating the process.
getter! error : IO::FileDescriptor

@process_info : Crystal::System::Process
Expand Down
2 changes: 1 addition & 1 deletion src/signal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ module Crystal::Signal
# signals that would be sent to the parent process through the signal
# pipe.
#
# We keep a signal set to because accessing @@handlers ins't thread safe —a
# We keep a signal set to because accessing @@handlers isn't thread safe —a
# thread could be mutating the hash while another one forked. This allows to
# only reset a few signals (fast) rather than all (very slow).
#
Expand Down
4 changes: 2 additions & 2 deletions src/string.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3282,7 +3282,7 @@ class String
{pre, mid, post}
end

# Returns the index of the _first_ ocurrence of *byte* in the string, or `nil` if not present.
# Returns the index of the _first_ occurrence of *byte* in the string, or `nil` if not present.
# If *offset* is present, it defines the position to start the search.
#
# Negative *offset* can be used to start the search from the end of the string.
Expand Down Expand Up @@ -4152,7 +4152,7 @@ class String
right_padding.times { io << char }
end

# Adds instances of *char* to left ond right of the string until it is at least size of *len*,
# Adds instances of *char* to left and right of the string until it is at least size of *len*,
# then appends the result to the given IO.
#
# ```
Expand Down
4 changes: 2 additions & 2 deletions src/string/utf16.cr
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class String
elsif 0xd800 <= byte < 0xdc00 &&
(i + 1) < slice.size &&
0xdc00 <= slice[i + 1] <= 0xdfff
# Surrougate pair
# Surrogate pair
codepoint = ((byte - 0xd800) << 10) + (slice[i + 1] - 0xdc00) + 0x10000
i += 1
else
Expand All @@ -162,7 +162,7 @@ class String
codepoint = byte
elsif 0xd800 <= byte < 0xdc00 &&
0xdc00 <= (pointer + 1).value <= 0xdfff
# Surrougate pair
# Surrogate pair
pointer = pointer + 1
codepoint = ((byte - 0xd800) << 10) + (pointer.value - 0xdc00) + 0x10000
else
Expand Down
2 changes: 1 addition & 1 deletion src/struct.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
struct Struct
# Returns `true` if this struct is equal to *other*.
#
# Both structs's instance vars are compared to each other. Thus, two
# Both structs' instance vars are compared to each other. Thus, two
# structs are considered equal if each of their instance variables are
# equal. Subclasses should override this method to provide specific
# equality semantics.
Expand Down
4 changes: 2 additions & 2 deletions src/time/location.cr
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Time::Location
# Raises `InvalidTimezoneOffsetError` if *seconds* is outside the supported
# value range `-86_400..86_400` seconds (`-24:00` to `+24:00`).
def initialize(@name : String?, @offset : Int32, @dst : Bool)
# Maximium offsets of IANA time zone database are -12:00 and +14:00.
# Maximum offsets of IANA time zone database are -12:00 and +14:00.
# +/-24 hours allows a generous padding for unexpected offsets.
# TODO: Maybe reduce to Int16 (+/- 18 hours).
raise InvalidTimezoneOffsetError.new(offset) if offset >= SECONDS_PER_DAY || offset <= -SECONDS_PER_DAY
Expand Down Expand Up @@ -239,7 +239,7 @@ class Time::Location
# `"UTC"` and empty string (`""`) return `Location::UTC`, and
# `"Local"` returns `Location.local`.
#
# The implementation uses a list of system-specifc paths to look for a time
# The implementation uses a list of system-specific paths to look for a time
# zone database.
# The first time zone database entry matching the given name that is
# successfully loaded and parsed is returned.
Expand Down
2 changes: 1 addition & 1 deletion src/time/span.cr
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct Time::Span
@nanoseconds = nanoseconds.to_i32
end

# Creates a new `Time::Span` from the *nanosenconds* given
# Creates a new `Time::Span` from the *nanoseconds* given
#
# Nanoseconds get normalized in the range of `0...1_000_000_000`,
# the nanosecond overflow gets added as seconds.
Expand Down

0 comments on commit 899ca63

Please sign in to comment.