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

Regression in cleanup trannsformer #6718

Closed
straight-shoota opened this issue Sep 13, 2018 · 1 comment
Closed

Regression in cleanup trannsformer #6718

straight-shoota opened this issue Sep 13, 2018 · 1 comment

Comments

@straight-shoota
Copy link
Member

straight-shoota commented Sep 13, 2018

The current nightly build of crinja shows a compiler regression in master. The build with a compiler at master fails, while 0.26.1 is fine.

This was probably introduced by #6659

I couldn't exactly pinpoint the failing part yet (the code base is quite large).
But it is reproducible with:

$ git clone https://github.com/straight-shoota/crinja && cd crinja
$ crystal-master spec spec/lib/filter_spec.cr

Callstack:

Nil assertion failed at /crystal/src/compiler/crystal/semantic/bindings.cr:530 (Exception)
  from /crystal/src/nil.cr:107:5 in 'not_nil!'
  from /crystal/src/compiler/crystal/semantic/bindings.cr:0:5 in 'program'
  from /crystal/src/compiler/crystal/semantic/bindings.cr:539:26 in 'update'
  from /crystal/src/compiler/crystal/semantic/bindings.cr:532:5 in 'update'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:746:7 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:380:7 in 'transform_many'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:262:10 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:258:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:258:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:138:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:324:7 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:7 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:263:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:138:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:461:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:299:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:138:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:461:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:299:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:138:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/transformer.cr:10:7 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:167:16 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:138:9 in 'transform'
  from /crystal/src/compiler/crystal/syntax/transformer.cr:7:14 in 'transform'
  from /crystal/src/compiler/crystal/semantic/cleanup_transformer.cr:9:14 in 'cleanup'
  from /crystal/src/compiler/crystal/semantic/main_visitor.cr:13:7 in 'visit_main'
  from /crystal/src/compiler/crystal/semantic/main_visitor.cr:5:5 in 'visit_main:process_finished_hooks:cleanup'
  from /crystal/src/compiler/crystal/semantic.cr:22:7 in 'semantic'
  from /crystal/src/compiler/crystal/compiler.cr:152:7 in 'compile'
  from /crystal/src/compiler/crystal/command/spec.cr:74:14 in 'spec'
  from /crystal/src/compiler/crystal/command.cr:88:7 in 'run'
  from /crystal/src/compiler/crystal/command.cr:46:5 in 'run'
  from /crystal/src/compiler/crystal/command.cr:45:3 in 'run'
  from /crystal/src/compiler/crystal.cr:8:1 in '__crystal_main'
  from /crystal/src/crystal/main.cr:97:5 in 'main_user_code'
  from /crystal/src/crystal/main.cr:86:7 in 'main'
  from /crystal/src/crystal/main.cr:106:3 in 'main'
  from __libc_start_main
  from _start
  from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

/cc @makenowjust

@makenowjust
Copy link
Contributor

Reproducible examples:

def pending(&block)
end

pending do
  {"foo" * 20}
end

And

def pending(&block)
end

pending do
  {s: "foo" * 20}
end

To compile the first example is failed on 0.26.1 too. That's interesting.

makenowjust added a commit to makenowjust/crystal that referenced this issue Sep 14, 2018
Fixed crystal-lang#6718

The reason of crystal-lang#6718 is calling `node.update` with untyped `TupleLiteral` or
`NamedTupleLiteral`. An untyped node has no `node.program`, so it fails nil
assertion.

I think this `node.update` is not needed because `CleanupTransformer`
does not change the type of `node` execpt for untyped and unreachable
node.  However such nodes should be transformed to other node.
In other words `node.update` does nothing in general.

Thus, this replaces `node.update` with treating untyped element.
makenowjust added a commit to makenowjust/crystal that referenced this issue Oct 12, 2018
Fixed crystal-lang#6718

The reason of crystal-lang#6718 is calling `node.update` with untyped `TupleLiteral` or
`NamedTupleLiteral`. An untyped node has no `node.program`, so it fails nil
assertion.

I think this `node.update` is not needed because `CleanupTransformer`
does not change the type of `node` execpt for untyped and unreachable
node.  However such nodes should be transformed to other node.
In other words `node.update` does nothing in general.

Thus, this replaces `node.update` with treating untyped element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants