Hi! I have encounter an unhandled exception which I suppose is due to an explicit cast instead of .ToArray()/.ToList() cast. The problem occurs as follows:
I have a grammar that uses the Map standard concept. So something like:
string[] a := A(f, b) = Map(\z:MapArgument => f, b);
MapArgument[] b:= B(....);
Now when I try to synthesise a program, PROSE throws the following exception (stack trace copied at the end): "Unable to cast object of type 'WhereSelectArrayIterator`2[System.Object,System.Object]' to type 'System.String[]'.".
"Unable to cast object of type 'WhereSelectArrayIterator`2[System.Object,System.Object]' to type 'System.String[]'."
at lambda_method(Closure , Object[] )
at Microsoft.ProgramSynthesis.Rules.BlackBoxRule.Evaluate(Object[] args)
at Microsoft.ProgramSynthesis.AST.NonterminalNode.Evaluate(State state)
at Microsoft.ProgramSynthesis.AST.ProgramNode.Invoke(State state)
at Microsoft.ProgramSynthesis.AST.LetNode.Evaluate(State state)
at Microsoft.ProgramSynthesis.AST.ProgramNode.Invoke(State state)
at Microsoft.ProgramSynthesis.AST.NonterminalNode.Evaluate(State state)
at Microsoft.ProgramSynthesis.AST.ProgramNode.Invoke(State state)
at Microsoft.ProgramSynthesis.VersionSpace.DirectProgramSet.<>c__DisplayClass7_0.<CalculateClusters>b__0(ProgramNode p)
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.ProgramSynthesis.VersionSpace.DirectProgramSet.CalculateClusters(State inputState)
at Microsoft.ProgramSynthesis.VersionSpace.ProgramSet.ClusterOnInput(State inputState)
at Microsoft.ProgramSynthesis.VersionSpace.ProgramSet.CalculateClusters(State[] inputStates)
at Microsoft.ProgramSynthesis.VersionSpace.ProgramSet.ClusterOnInputTuple(IEnumerable`1 inputStates)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.BuildFromDependencies(WitnessingPlan plan, List`1 order, Int32 current, IDictionary`2 graph, ImmutableDictionary`2 prereqsBindings, SynthesisEngine engine, CancellationToken cancel, NonterminalRule rule, LearningTask`1 task)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.BuildFromDependencies(WitnessingPlan plan, List`1 order, Int32 current, IDictionary`2 graph, ImmutableDictionary`2 prereqsBindings, SynthesisEngine engine, CancellationToken cancel, NonterminalRule rule, LearningTask`1 task)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.LearnRuleFromWitnesses(SynthesisEngine engine, NonterminalRule rule, LearningTask`1 task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.LearnSymbol(SynthesisEngine engine, LearningTask`1 task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.Strategies.SynthesisStrategy`2.Learn(SynthesisEngine engine, LearningTask task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.<>c__DisplayClass25_2.<LearnSymbol>b__0()
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.InvokeStrategy[TResult](Func`1 learner)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.LearnSymbol(LearningTask task, Nullable`1 cancel)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.LearnRuleFromWitnesses(SynthesisEngine engine, NonterminalRule rule, LearningTask`1 task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.Strategies.DeductiveSynthesis.LearnSymbol(SynthesisEngine engine, LearningTask`1 task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.Strategies.SynthesisStrategy`2.Learn(SynthesisEngine engine, LearningTask task, CancellationToken cancel)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.<>c__DisplayClass25_2.<LearnSymbol>b__0()
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.InvokeStrategy[TResult](Func`1 learner)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.LearnSymbol(LearningTask task, Nullable`1 cancel)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.LearnSymbol(Symbol symbol, Spec spec, Nullable`1 cancel)
at Microsoft.ProgramSynthesis.Learning.SynthesisEngine.LearnGrammar(Spec spec, Nullable`1 cancel)
at Synthesis.Program.Main(String[] args) in z:\Repos\...
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()