NFun
NFun copied to clipboard
Calculate last common ancestor for complex and primitive type
out = [[1],true]
expected: out: any actual: Runtime error. Unable to cast from Real[] to Bool
- [x] workaround: deny such casts for a while
- [x] allow composite type as constraint descendant
- [x] array fits
- [x] array lca
- [x] array max type
- [x] arrays
- [ ] Support Comparables (6380 passed)
- [x] fun lca (6427 passed)
- [x] fun Fits (6444 passed)
- [x] fun max type
- [x] funs
- [ ] struct fits
- [ ] struct lca
- [ ] struct max type
- [ ] structs
- [ ] Test for lca of funs, that handles funs as arguments
- [ ] Test for lca of funs, that handles arrays as arguments
- [ ] Test for lca of arrays that handle funs as arguments
- [ ] misc
- [ ] benchmarks
x = if(true)
{
age = 42
name = 'vasa'
size = m
}
else
{
age = 42
}
out = x.age #ok. :int
out2 = x.name #fails, as it is not generic
------------------
f1 = rule it.age + it.size
f2 = rule it.age
f3 = if(true) f1 else f2
out1 = f4({age = 42, size = 15}) #ok, int
out2 = f3({age = 42}) #error
------------------
f1 = rule it.size
f2 = rule it.age
f3 = if(true) f1 else f2
out1 = f4({age = 42, size = 15}) #ok, int
out2 = f3({age = 42}) #error
-----------------------
arr = [{age=42}, {age = 42, size = 15}]
out1 = arr[0].age #ok, int
out2 = arr[0].size #error
-----------------------
x =
if(true) { age = 0x1 }
else { age = 42.0 }
out = x.age #ok. :real
------------------
x =
if(true) { age = 0x1 }
else if(false) { age = 'name' }
else { age = 42.0 }
out = x.age #ok. :any
------------------
x =
if(true) { age = in1 }
else if(false) { age = in2 }
else { age = in3 }
out:real = x.age #ok. :in1 == :in2 == :in3 == :real
------------------