Skip to content

Commit

Permalink
Merge pull request #497 from savi-lang/fix/some-error-messages
Browse files Browse the repository at this point in the history
Fix some compiler errors to show more information.
  • Loading branch information
jemc committed Sep 7, 2024
2 parents 5d1dd8e + 80f3326 commit d59b999
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions main.cr
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ module Savi
if check_only
sources.each { |source_package, sources|
ctx = Savi.compiler.compile(sources, :manifests, options)
errors.concat(ctx.errors)
next if errors.any?

AST::Format.check(ctx, ctx.root_package_link, ctx.root_docs)
errors.concat(ctx.errors)
}
Expand All @@ -401,6 +404,9 @@ module Savi
edited_count = 0
sources.each { |source_package, sources|
ctx = Savi.compiler.compile(sources, :manifests, options)
errors.concat(ctx.errors)
next if errors.any?

edits_by_doc =
AST::Format.run(ctx, ctx.root_package_link, ctx.root_docs)

Expand Down
9 changes: 6 additions & 3 deletions src/savi/compiler/code_gen/continuation_info.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ class Savi::Compiler::CodeGen
# We don't yet support the case where the public elements of the
# continuation data do not match - they would need to be boxed/unboxed
# in a wrapper virtual function, which we don't yet have code for.
public_elements_match = concrete_infos
.map(&.struct_element_types.[0...3].as(Array(LLVM::Type))).uniq.one?
public_elements_uniq = concrete_infos
.map(&.struct_element_types.[0...3].as(Array(LLVM::Type))).uniq
public_elements_match = public_elements_uniq.one?
raise NotImplementedError.new \
"heterogenous public members of virtual continuation types" \
"heterogenous public members of virtual continuation types: #{
public_elements_uniq
}" \
unless public_elements_match

# Create a virtual continuation struct type which has all of the
Expand Down

0 comments on commit d59b999

Please sign in to comment.