You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can not expand the macro when the program is set to main.cr
$ crystal tool expand -c test.cr:8:3 main.cr
no expansion found
The text was updated successfully, but these errors were encountered:
LeonLiuY
changed the title
[crystal tool expand] Can not expand macro in class body.
[crystal tool expand] Can not expand macro in class body other than the main file.
May 15, 2018
LeonLiuY
changed the title
[crystal tool expand] Can not expand macro in class body other than the main file.
[crystal tool expand] Can not expand macro in class body of included files.
May 15, 2018
I want to expand the schema macro in Crecto model, but it fails.
classUser < Crecto::Model
schema "users"do
field :age, Int32# or use `PkeyValue` alias: `field :age, PkeyValue`
field :name, String
field :is_admin, Bool, default:false
field :temporary_info, Float64, virtual:true
field :email, String
has_many :posts, Post, dependent::destroyend
validate_required [:name, :age]
validate_format :name, /^[a-zA-Z]*$/
unique_constraint :emailend
I have my file structure:
models
user.cr
...
app.cr
where app.cr requries libraries needed for the application as the main file. So It's not convenient to use user.cr as the main file of crystal tool expand (compile error)
…ire` (fixedcrystal-lang#6098)
As a side effect, `crystal tool expand` can expand `require` statement now.
I think it may help us.
Note that spec is missing for now.
Because there are no foundation to write `tool expand` spec over multiple files currently.
Crystal version: 0.24.1
test.cr
main.cr
Facts
The program has no problem:
$ crystal run main.cr "hey"
Can expand the macro when the program is set to
test.cr
Can not expand the macro when the program is set to
main.cr
The text was updated successfully, but these errors were encountered: