Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jul 26, 2021
  2. Jul 25, 2021
  3. Jul 24, 2021
  4. Jul 23, 2021
  5. Jul 20, 2021
  6. Jul 14, 2021
  7. Jul 13, 2021
  8. Jul 12, 2021
  9. Jul 08, 2021
  10. Jul 07, 2021
  11. Jul 05, 2021
  12. Jul 03, 2021
  13. Jul 02, 2021
  14. Jul 01, 2021
  15. Jun 29, 2021
  16. Jun 28, 2021
  17. Jun 26, 2021
  18. Jun 25, 2021
    • Johannes Müller's avatar
    • Johannes Müller's avatar
      Add macro method ASTNode#nil? (#10850) · 278c15b7
      Johannes Müller authored
      #10616 removed a bug that the compiler accepted calls to nil? in macro expressions where that method does not exist. These calls were internally transformed to is_a?(Nil). In the macro interpreter, no value can be of type Nil because that's a runtime type, so any nil? call would always return false.
      Removing that transformation from the parser made nil? calls in macro expressions errors because that method is not defined.
      
      But users would expect nil.nil? to return true. So this patch implements ASTNode#nil? in the macro interpreter. It returns true if the value is a NilLiteral or Nop.
      
      This is technically a feature addition, but we should still merge it for 1.1 despite the feature freeze. It actually avoids a breaking change that would occur with #10616 alone. Code that worked in 1.0 would no longer compile (even though it was already broken before and just worked by chance). With this PR, it continues to compile and fulfills the intended purpose.
      278c15b7
  19. Jun 21, 2021
  20. Jun 19, 2021
  21. Jun 18, 2021
Loading