Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e4a15be90b83
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ff006ffc045b
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Jun 6, 2016

  1. Copy the full SHA
    2a023e1 View commit details
  2. Compiler: give error on Pointer.allocate

    Ary Borenszweig committed Jun 6, 2016
    Copy the full SHA
    ff006ff View commit details
2 changes: 2 additions & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
@@ -1322,6 +1322,8 @@ describe "Parser" do
assert_syntax_error "{foo: 1\nbar: 2}"
assert_syntax_error "{foo: 1, bar: 2\nbaz: 3}"

assert_syntax_error "'''", "invalid empty char literal"

describe "end locations" do
assert_end_location "nil"
assert_end_location "false"
7 changes: 7 additions & 0 deletions spec/compiler/type_inference/pointer_spec.cr
Original file line number Diff line number Diff line change
@@ -162,4 +162,11 @@ describe "Type inference: pointer" do
LibFoo.foo(Foo.new)
)) { float64 }
end

it "errors if doing Pointer.allocate" do
assert_error %(
Pointer(Int32).allocate
),
"can't create instance of a pointer type"
end
end
2 changes: 2 additions & 0 deletions src/compiler/crystal/semantic/main_visitor.cr
Original file line number Diff line number Diff line change
@@ -2015,6 +2015,8 @@ module Crystal
node.raise "can't create instance of generic class #{instance_type} without specifying its type vars"
when UnionType
node.raise "can't create instance of a union type"
when PointerInstanceType
node.raise "can't create instance of a pointer type"
end

if !instance_type.virtual? && instance_type.abstract?
2 changes: 2 additions & 0 deletions src/compiler/crystal/syntax/lexer.cr
Original file line number Diff line number Diff line change
@@ -572,6 +572,8 @@ module Crystal
else
@token.value = char2
end
when '\''
raise "invalid empty char literal (did you mean '\\\''?)", line, column
when '\0'
raise "unterminated char literal", line, column
else
10 changes: 5 additions & 5 deletions src/xml/xml.cr
Original file line number Diff line number Diff line change
@@ -28,11 +28,11 @@
# ```
module XML
SUBSTITUTIONS = {
'>' => ">",
'<' => "&lt;",
'"' => "&quot;",
''' => "&apos;",
'&' => "&amp;",
'>' => "&gt;",
'<' => "&lt;",
'"' => "&quot;",
'\'' => "&apos;",
'&' => "&amp;",
}

def self.escape(string : String)