Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more typos #7242

Merged
merged 3 commits into from
Dec 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ class Array(T)
end

# Modifies `self` by randomizing the order of elements in the collection
# using the given *random* number generator. Returns `self`.
# using the given *random* number generator. Returns `self`.
def shuffle!(random = Random::DEFAULT)
@buffer.shuffle!(size, random)
self
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module Crystal
# an "Reference**" llvm value and you need to load that value
# to access it.
# However, the "self" argument is not copied to a local variable:
# it's accessed from the arguments list, and it a "Reference*"
# it's accessed from the arguments list, and is a "Reference*"
# llvm value, so in a way it's "already loaded".
# This field is true if that's the case.
getter already_loaded : Bool
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Crystal
CC = ENV["CC"]? || "cc"
CL = "cl"

# A source to the compiler: it's filename and source code.
# A source to the compiler: its filename and source code.
record Source,
filename : String,
code : String
Expand Down Expand Up @@ -83,7 +83,7 @@ module Crystal
# one LLVM module is created for each type in a program.
property? single_module = false

# Set to a `ProgressTracker` object which tracks compilation progress.
# A `ProgressTracker` object which tracks compilation progress.
property progress_tracker = ProgressTracker.new

# Target triple to use in the compilation.
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/crystal/macros.cr
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module Crystal::Macros
# Compiles and execute a Crystal program and returns its output
# as a `MacroId`.
#
# The file denote by *filename* must be a valid Crystal program.
# The file denoted by *filename* must be a valid Crystal program.
# This macro invocation passes *args* to the program as regular
# program arguments. The program must output a valid Crystal expression.
# This output is the result of this macro invocation, as a `MacroId`.
Expand Down Expand Up @@ -126,7 +126,7 @@ module Crystal::Macros
# shell commands at compile time, or other macro run programs). It's also strongly
# discouraged to have a macro run program take a lot of time, because this will
# slow down compilation times. Reading files is OK, opening an HTTP connection
# at compile-time will most likely result if very slow compilations.
# at compile-time will most likely result in very slow compilations.
def run(filename, *args) : MacroId
end

Expand Down Expand Up @@ -839,8 +839,8 @@ module Crystal::Macros
def default_value : ASTNode
end

# Returns whether this variable has a default value (which.
# can in turn be `nil`).
# Returns whether this variable has a default value
# (which can in turn be `nil`).
def has_default_value? : BoolLiteral
end

Expand Down
16 changes: 8 additions & 8 deletions src/compiler/crystal/program.cr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module Crystal
#
# The way we detect this is by remembering the type of the splat,
# associated to a def's object id (the UInt64), and on an instantiation
# we compare the new type with the previous one and check if if contains
# we compare the new type with the previous one and check if it contains
# the previous type.
getter splat_expansions = {} of UInt64 => Type

Expand Down Expand Up @@ -110,7 +110,7 @@ module Crystal
# The main filename of this program
property filename : String?

# Set to a `ProgressTracker` object which tracks compilation progress.
# A `ProgressTracker` object which tracks compilation progress.
property progress_tracker = ProgressTracker.new

def initialize
Expand Down Expand Up @@ -204,7 +204,7 @@ module Crystal
types["ARGC_UNSAFE"] = @argc = argc_unsafe = Const.new self, self, "ARGC_UNSAFE", Primitive.new("argc", int32)
types["ARGV_UNSAFE"] = @argv = argv_unsafe = Const.new self, self, "ARGV_UNSAFE", Primitive.new("argv", pointer_of(pointer_of(uint8)))

# Make sure to initialize ARGC and ARGV as soon as the program starts
# Make sure to initialize `ARGC_UNSAFE` and `ARGV_UNSAFE` as soon as the program starts
class_var_and_const_initializers << argc_unsafe
class_var_and_const_initializers << argv_unsafe

Expand Down Expand Up @@ -429,7 +429,7 @@ module Crystal
end
property recorded_requires = [] of RecordedRequire

# Rmembers that the program depends on this require.
# Remembers that the program depends on this require.
def record_require(filename, relative_to) : Nil
recorded_requires << RecordedRequire.new(filename, relative_to)
end
Expand All @@ -452,12 +452,12 @@ module Crystal
end
{% end %}

# Returns the `Nil` `Type`
# Returns the `Nil` type
def nil_type
@nil.not_nil!
end

# Returns the `Hash` `Type`
# Returns the `Hash` type
def hash_type
@hash_type.not_nil!
end
Expand Down Expand Up @@ -496,12 +496,12 @@ module Crystal
end
end

# Retutns the `Struct` type
# Returns the `Struct` type
def struct
@struct_t.not_nil!
end

# Retutns the `Class` type
# Returns the `Class` type
def class_type
@class.not_nil!
end
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 @@ -45,7 +45,7 @@ class Crystal::Call
return recalculate_lib_call obj_type
end

# Check if it's call inside LibFoo
# Check if its call is inside LibFoo
# (can happen when assigning the call to a constant)
if !obj && (lib_type = scope()).is_a?(LibType)
return recalculate_lib_call lib_type
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/semantic/main_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ module Crystal

if var.freeze_type
deps = var.dependencies?
# If no dependencies it's the case of a global for a regex literal.
# If no dependencies, it's the case of a global for a regex literal.
# If there are dependencies and it's just one, it's the same var
deps ? deps.size == 1 : false
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct Crystal::TypeDeclarationProcessor
# Check if var is uninitialized
var.uninitialized = true if info.uninitialized

# If the variable is gueseed to be nilable because it is not initialized
# If the variable is guessed to be nilable because it is not initialized
# in all of the initialize methods, and the explicit type is not nilable,
# give an error right now
if check_nilable && instance_var && !var.type.includes_type?(@program.nil)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/lexer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ module Crystal
end
when '#'
if delimiter_state
# If it's "#{..." we don't want "#{{{" to parse it as "# {{ {", but as "#{ {{"
# If it's "#{...", we don't want "#{{{" to parse it as "# {{ {", but as "#{ {{"
# (macro expression inside a string interpolation)
if peek_next_char == '{'
char = next_char
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/init/template/gitignore.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<%- if config.skeleton_type == "lib" -%>

# Libraries don't need dependency lock
# Dependencies will be locked in application that uses them
# Dependencies will be locked in applications that use them
/shard.lock
<%- end -%>
4 changes: 2 additions & 2 deletions src/compiler/crystal/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ module Crystal
raise "BUG: #{self} doesn't implement add_subclass"
end

# Replaces type parameetrs in this type with the type parameters
# Replace type parameters in this type with the type parameters
# of the given *instance* type.
def replace_type_parameters(instance) : Type
self
Expand Down Expand Up @@ -694,7 +694,7 @@ module Crystal
end

# A type that has a name and can be inside a namespace.
# For example, given `class Foo::Bar`, `Foo` is the namespace and `Bar` is the name.
# For example, given `class Foo::Bar`, `Foo` is the namespace and `Bar` is the name.
#
# There are other types that have a name but it can be deduced from other(s) type(s),
# so they don't inherit NamedType: a union type, a metaclass, etc.
Expand Down
4 changes: 2 additions & 2 deletions src/concurrent.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "./concurrent/*"

# Blocks the current fiber for the specified number of seconds.
#
# While this fiber is waiting this time other ready-to-execute
# While this fiber is waiting this time, other ready-to-execute
# fibers might start their execution.
def sleep(seconds : Number)
if seconds < 0
Expand All @@ -17,7 +17,7 @@ end

# Blocks the current Fiber for the specified time span.
#
# While this fiber is waiting this time other ready-to-execute
# While this fiber is waiting this time, other ready-to-execute
# fibers might start their execution.
def sleep(time : Time::Span)
Crystal::Scheduler.sleep(time)
Expand Down
4 changes: 2 additions & 2 deletions src/concurrent/future.cr
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Concurrent::Future(R)
end

# Spawns a `Fiber` to compute *&block* in the background after *delay* has elapsed.
# Access to get is synchronized between fibers. *&block* is only called once.
# Access to get is synchronized between fibers. *&block* is only called once.
# May be canceled before *&block* is called by calling `cancel`.
# ```
# d = delay(1) { Process.kill(Signal::KILL, Process.pid) }
Expand All @@ -140,7 +140,7 @@ def future(&exp : -> _)
end

# Conditionally spawns a `Fiber` to run *&block* in the background.
# Access to get is synchronized between fibers. *&block* is only called once.
# Access to get is synchronized between fibers. *&block* is only called once.
# *&block* doesn't run by default, only when `get` is called.
# ```
# l = lazy { expensive_computation }
Expand Down
2 changes: 1 addition & 1 deletion src/crystal/system/dir.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Crystal::System::Dir
# Rewinds the iterator to the beginning of the directory.
# def self.rewind(handle : Handle) : Nil

# Closes *handle*, freeing it's resources.
# Closes *handle*, freeing its resources.
# def self.close(handle : Handle) : Nil

# Returns the current working directory of the application.
Expand Down
2 changes: 1 addition & 1 deletion src/crystal/system/win32/file.cr
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module Crystal::System::File
return check_not_found_error("GetFileAttributesEx") if ret == 0

if file_attributes.dwFileAttributes.bits_set? LibC::FILE_ATTRIBUTE_REPARSE_POINT
# Could be a symlink, retrieve it's reparse tag with FindFirstFile
# Could be a symlink, retrieve its reparse tag with FindFirstFile
handle = LibC.FindFirstFileW(winpath, out find_data)
return check_not_found_error("FindFirstFile") if handle == LibC::INVALID_HANDLE_VALUE

Expand Down
4 changes: 2 additions & 2 deletions src/file.cr
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class File < IO::FileDescriptor

current = bytes.size - 1

# if the pattern is foo. it has no extension
# if the pattern is foo, it has no extension
return "" if bytes[current] == '.'.ord

# position the reader at the last . or SEPARATOR
Expand All @@ -351,7 +351,7 @@ class File < IO::FileDescriptor
current -= 1
end

# if we are the beginning of the string there is no extension
# if we are at the beginning of the string, there is no extension.
# /foo or .foo have no extension
return "" unless current > 0

Expand Down
2 changes: 1 addition & 1 deletion src/file/info.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class File
#
# The binary representation of this enum is defined to be same representation
# as the permission bits of a unix `st_mode` field. `File::Permissions`
# can also be compared to it's underlying bitset, for example
# can also be compared to its underlying bitset, for example
# `File::Permissions::All == 0o777` will always be `true`.
#
# On windows, only the `OwnerWrite` bit is effective. All file permissions
Expand Down
2 changes: 1 addition & 1 deletion src/http/server.cr
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class HTTP::Server
# Returns `true` if this server is closed.
getter? closed : Bool = false

# Returns `true` if this server is listening on it's sockets.
# Returns `true` if this server is listening on its sockets.
getter? listening : Bool = false

# Creates a new HTTP server with the given block as handler.
Expand Down
2 changes: 1 addition & 1 deletion src/io.cr
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ abstract class IO
ascii = delimiter.ascii?
decoder = decoder()

# # If the char's representation is a single byte and we have an encoding,
# If the char's representation is a single byte and we have an encoding,
# search the delimiter in the buffer
if ascii && decoder
return decoder.gets(self, delimiter.ord.to_u8, limit: limit, chomp: chomp)
Expand Down
2 changes: 1 addition & 1 deletion src/static_array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct StaticArray(T, N)
end

# Modifies `self` by randomizing the order of elements in the array
# using the given *random* number generator. Returns `self`.
# using the given *random* number generator. Returns `self`.
#
# ```
# a = StaticArray(Int32, 3).new { |i| i + 1 } # => StaticArray[1, 2, 3]
Expand Down
10 changes: 5 additions & 5 deletions src/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ struct Time
end

# Creates an instance specified by a commercial week date consisting of ISO
# calendar *year* and *week* and a *day_of_week`.
# calendar *year*, *week* and a *day_of_week*.
#
# This equates to the results from `#calendar_week` and `#day_of_week`.
#
Expand All @@ -797,7 +797,7 @@ struct Time
# * `day_of_week`: `1..7`
def self.week_date(year : Int32, week : Int32, day_of_week : Int32 | DayOfWeek, hour : Int32 = 0, minute : Int32 = 0, second : Int32 = 0, *, nanosecond : Int32 = 0, location : Location = Location.local) : self
# For this calculation we need to know the weekday of Januar 4.
# The number of the day plus a fixed offset of 4 gives a correction valud
# The number of the day plus a fixed offset of 4 gives a correction value
# for this year.
jan4_day_of_week = Time.utc(year, 1, 4).day_of_week
correction = jan4_day_of_week.to_i + 4
Expand Down Expand Up @@ -878,7 +878,7 @@ struct Time
# Returns `true` if `#location` equals to the local time zone
# (`Time::Location.local`).
#
# Since the system's settings may change during a programm's runtime,
# Since the system's settings may change during a program's runtime,
# the result may not be identical between different invocations.
def local? : Bool
location.local?
Expand All @@ -890,7 +890,7 @@ struct Time
# date-time representation (wall clock) would compare differently.
#
# To ensure the comparison is also true for local wall clock, both date-times
# need to be transforemd to the same time zone.
# need to be transformed to the same time zone.
def <=>(other : Time) : Int32
cmp = total_seconds <=> other.total_seconds
cmp = nanosecond <=> other.nanosecond if cmp == 0
Expand Down Expand Up @@ -1133,7 +1133,7 @@ struct Time
end

# Parses a `Time` from *time* string using the given *pattern* and
# `Time::Location.local` asdefault location
# `Time::Location.local` as default location
#
# See `Time::Format` for details.
#
Expand Down
2 changes: 1 addition & 1 deletion src/time/location.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require "./location/loader"
# The local time zone can be accessed as `Time::Location.local`.
#
# It is initially configured according to system environment settings,
# but it's value can be changed:
# but its value can be changed:
#
# ```
# location = Time::Location.local
Expand Down
4 changes: 2 additions & 2 deletions src/tuple.cr
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ struct Tuple
include Indexable(Union(*T))
include Comparable(Tuple)

# Creates a tuple that will contain the given arguments.
# Creates a tuple that will contain the given values.
#
# This method is useful in macros and generic code because with it you can
# creates empty tuples, something that you can't do with a tuple literal.
# create empty tuples, something that you can't do with a tuple literal.
#
# ```
# Tuple.new(1, "hello", 'x') #=> {1, "hello", 'x'}
Expand Down