Comments (3)
Sorry. It took times to find exception point.
alias DslReplaceCondsFn = -> Bool
alias DslReplaceConds = Array(DslReplaceConds) | DslReplaceCondsFn
def _replace_map(cond : DslReplaceConds) : DslReplaceCondsFn
if cond.is_a?(Array)
cond_fns = cond.map { |x| _replace_map(x) }
->() { (cond_fns.all? { |fn| fn.call }) } # problem is here if write "? true : false " problem wil be fixed
else
->() { false }
end
end
_replace_map([-> () { true }, -> () { false }])
from crystal.
Can you share a minimal reproducible example that causes this error?
from crystal.
You could also write -> : Bool { cond_fns.all? { |fn| fn.call } }
, since it looks like the compiler had issues inferring that return type.
Reduction: (note that recursive types are not needed here, only a recursive def)
class Foo
@x = uninitialized -> Bool
end
def foo(cond) : -> Bool
if cond.is_a?(Foo)
-> { foo(cond.@x).call }
else
cond
end
end
foo(Foo.new)
from crystal.
Related Issues (20)
- Struct#pretty_print Sorts Fields by Name HOT 6
- Hex Array Literals HOT 4
- Case insensitive comparison through Quality of Life method `String#=~(other : String)` HOT 4
- `unsafe_as` should be a compiler primitive HOT 4
- Remove `Pointer.new(Int)` HOT 4
- UTF-16 string literals HOT 14
- Non-atomic memory is cleared twice HOT 6
- `GC.malloc` doesn't clear memory (as specified) for `gc_none`
- [RFC] Add `URI::Params::Serializable`
- UTF-8 support in Windows API HOT 1
- Non-zero padded exponent in float string representation after Ryu implementation HOT 6
- Allocation of non-zeroed memory for performance boost HOT 11
- Crystal::Macros::Arg#restriction method always returns Nop HOT 1
- Nilable `Proc` types inside libs
- Cannot return `Proc`s from top-level funs
- `ReferenceStorage(T)` is always atomic even when `T` isn't HOT 1
- Add `crystal tool method_types` for listing method parameter types HOT 4
- Passing nil to Addrinfo.getaddrinfo gives unexpected error message HOT 1
- Package installation fails on Windows due to missing SQLite3 .lib files HOT 2
- `File#truncate` raises `File::AccessDeniedError` on Windows when file was opened in append mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crystal.