Log: There is no context to infer the closure's argument types from

Thomas is right, at compile time (i.e. when the Rules are loaded) the Rules Engine can’t figure out what type is being used in the lambdas (everything between is a lambda). In particular, it can’t figure out what the type of battery is in the first filter in your first Rule or i isin the Windows filter in your second rule.

Adding the type to the result of head might work. If it doesn’t give a type to the items in the filter.

    val window = Windows.members.filter[ ContactItem i | i.name.contains(room) ].head

I just did a grep through my Rules and I’ve see I use both over the years.

2 Likes