Open Kuinox opened 1 year ago
Another snippet, another bug:
func main() {
var i = 0;
println(i.ToString());
}
Exception:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'expr')
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitCallExpr(Call node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExpr(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitPunctuated[Expr](Punctuated`1 punctuated)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitPunctuatedList[Expr](PunctuatedList`1 list)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitEnclosed[Expr](Enclosed`1 enclosed)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitCallExpr(Call node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitCallExpr(Call node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExpr(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExprStmt(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitStmt(Stmt node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitImmutableArray[Stmt](ImmutableArray`1 elements)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockContents(BlockContents node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitEnclosed[BlockContents](Enclosed`1 enclosed)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockExpr(Block node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockBodyFuncBody(BlockBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncBody(FuncBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncDecl(Func node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseTree tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseTree,TypeInferenceVisitor,TypeInferenceResult](ParseTree args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Editor.Web.Program.DisplayCompiledCSharp(Compilation compilation)
at Draco.Editor.Web.Program.ProcessUserInput()
Another snippet:
func main() {
var i = i +
}
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'expr')
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitBinaryExpr(Binary node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExpr(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitValueInitializer(ValueInitializer node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitVariableDecl(Variable node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitVariableDecl(Variable node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDeclStmt(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitStmt(Stmt node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitImmutableArray[Stmt](ImmutableArray`1 elements)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockContents(BlockContents node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitEnclosed[BlockContents](Enclosed`1 enclosed)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockExpr(Block node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockBodyFuncBody(BlockBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncBody(FuncBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncDecl(Func node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseTree tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseTree,TypeInferenceVisitor,TypeInferenceResult](ParseTree args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Editor.Web.Program.DisplayCompiledCSharp(Compilation compilation)
at Draco.Editor.Web.Program.ProcessUserInput()
Another error when there is missing type anotation
func main():{}
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c__DisplayClass1_0.<Evaluate>b__0(TypeExpr expr)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.TypeExpr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, TypeExpr a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.TypeExpr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Type](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[TypeExpr,Unit,Type](TypeExpr args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[TypeExpr,Type](TypeExpr args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.Evaluate(QueryDatabase db, TypeExpr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseTree tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseTree,TypeInferenceVisitor,TypeInferenceResult](ParseTree args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
Another bug
func main(){
return;
}
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'expr')
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass3_0.<ToAst>b__0(Expr expr)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, Expr a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Expr](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Expr,Unit,Expr](Expr args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Expr,Expr](Expr args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass2_0.<ToAst>b__0(Stmt stmt)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, Stmt a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Stmt](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Stmt,Unit,Stmt](Stmt args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Stmt,Stmt](Stmt args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, Stmt stmt)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass3_0.<ToAst>b__1(Stmt s)
at System.Linq.Enumerable.SelectArrayIterator`2[[Draco.Compiler.Api.Syntax.ParseTree.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Stmt](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Stmt](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Stmt](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Stmt](IEnumerable`1 items)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass3_0.<ToAst>b__0(Expr expr)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, Expr a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Expr](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Expr,Unit,Expr](Expr args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Expr,Expr](Expr args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass5_0.<ToAst>b__0(FuncBody funcBody)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.FuncBody, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr.Block, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, FuncBody a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.FuncBody, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr.Block, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Block](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[FuncBody,Unit,Block](FuncBody args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[FuncBody,Block](FuncBody args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, FuncBody funcBody)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass1_0.<ToAst>b__0(Decl decl)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, Decl a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Decl](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Decl,Unit,Decl](Decl args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[Decl,Decl](Decl args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, Decl decl)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass4_0.<ToAst>b__1(Decl d)
at System.Linq.Enumerable.SelectArrayIterator`2[[Draco.Compiler.Api.Syntax.ParseTree.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Decl](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Decl](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Decl](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Decl](IEnumerable`1 items)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.<>c__DisplayClass4_0.<ToAst>b__0(CompilationUnit cu)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, CompilationUnit a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,CompilationUnit](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[CompilationUnit,Unit,CompilationUnit](CompilationUnit args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[CompilationUnit,CompilationUnit](CompilationUnit args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, CompilationUnit cu)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstBuilder.ToAst(QueryDatabase db, ParseTree ast)
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
Exception when creating a function with two parameters of the same type and name and then calling the function.
func main() {
val x = foo("a", "b");
println(x);
}
func foo(x: string, x: string): string = x;
System.InvalidOperationException: can't compare type variables
at Draco.Compiler.Internal.Semantics.Types.Type.Variable.Equals(Variable other)
at Draco.Compiler.Internal.Semantics.Types.Type.Variable.Equals(Object obj)
at Draco.Compiler.Internal.Semantics.Types.Type.Variable.Equals(Type other)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.IsUnit(Type type)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.DefineRegister(Type type, String name, String expr)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.VisitVariableDecl(Variable node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitDecl(Decl node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitDeclStmt(Decl node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitStmt(Stmt node)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.VisitBlockExpr(Block node)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.VisitFuncDecl(Func node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitDecl(Decl node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitImmutableArray(ImmutableArray`1 decls)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCompilationUnit(CompilationUnit node)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.AstVisitorBase`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Visit(Ast node)
at Draco.Compiler.Internal.Codegen.CSharpCodegen.Generate(Ast root)
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
Exception when referencing an unknown type in either the return type or a parameter type of a function.
func foo(): Foo = x;
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c__DisplayClass1_0.<Evaluate>b__0(TypeExpr expr)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ParseTree.TypeExpr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, TypeExpr a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree.TypeExpr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Type](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[TypeExpr,Unit,Type](TypeExpr args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[TypeExpr,Type](TypeExpr args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.Evaluate(QueryDatabase db, TypeExpr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseTree tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseTree,TypeInferenceVisitor,TypeInferenceResult](ParseTree args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
func main(a: int32) {}
error: roslyn reported an error while compiling the generated C# code The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
error: roslyn reported an error while compiling the generated C# code There is no argument given that corresponds to the required formal parameter 'sym_1' of 'DracoProgram.main(int)'
func main() {
println(b("1"));
}
var b= "2";
func b(b:string):string { return b; }
error: roslyn reported an error while compiling the generated C# code The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
error: roslyn reported an error while compiling the generated C# code The type 'DracoProgram' already contains a definition for 'b'
error: roslyn reported an error while compiling the generated C# code Cannot assign to 'b' because it is a 'method group'
error: roslyn reported an error while compiling the generated C# code Field 'DracoProgram.b' is never assigned to, and will always have its default value null
func main() {
println(a("1"));
}
func a(a: string):string {}
error: roslyn reported an error while compiling the generated C# code The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
error: roslyn reported an error while compiling the generated C# code 'DracoProgram.a(string)': not all code paths return a value
func main() {
var
println("");
}
Assigning to a type or referencing a type in place of a variable in general.
func main() {
int32 = 0;
}
func main(): int32 {
return int32;
}
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, ISymbol symbol)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitBinaryExpr(Binary node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExpr(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExprStmt(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitStmt(Stmt node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitImmutableArray[Stmt](ImmutableArray`1 elements)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockContents(BlockContents node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitEnclosed[BlockContents](Enclosed`1 enclosed)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockExpr(Block node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockBodyFuncBody(BlockBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncBody(FuncBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncDecl(Func node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseTree node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseTree tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseTree,TypeInferenceVisitor,TypeInferenceResult](ParseTree args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseTree tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseTree, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|8_0(ParseTree tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
val x = x;
System.InvalidOperationException: Cycle detected:
* TypeOf [Draco.Compiler.Internal.Semantics.Symbols.ISymbol+Variable]
* InferLocalTypes [val x = x;]
* TypeOf [Draco.Compiler.Internal.Semantics.Symbols.ISymbol+Variable]
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Type](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ITyped,Unit,Type](ITyped args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ITyped,Type](ITyped args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, ISymbol symbol)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitVariableDecl(Variable node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseNode node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseNode tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseNode tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseNode, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseNode,TypeInferenceVisitor,TypeInferenceResult](ParseNode args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseNode tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c__DisplayClass3_0.<TypeOf>b__0(ITyped typed)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Internal.Semantics.Symbols.ISymbol.ITyped, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, ITyped a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Internal.Semantics.Symbols.ISymbol.ITyped, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Type](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ITyped,Unit,Type](ITyped args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ITyped,Type](ITyped args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, ISymbol symbol)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseNode tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|10_0(ParseNode tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseNode, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|10_0(ParseNode tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.EmitCSharp(Stream csStream)
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream csStream, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation, Func`2 csCompilerOptionBuilder)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
func main() {
println(0.1);
}
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'expr')
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.TypeOf(QueryDatabase db, Expr expr)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.<>c__DisplayClass24_0.<VisitCallExpr>b__0(Punctuated`1 a)
at System.Linq.Enumerable.SelectArrayIterator`2[[Draco.Compiler.Api.Syntax.ParseNode.Punctuated`1[[Draco.Compiler.Api.Syntax.ParseNode.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Internal.Semantics.Types.Type, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Type](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Type](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Type](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Type](IEnumerable`1 items)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitCallExpr(Call node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExpr(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitExprStmt(Expr node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitStmt(Stmt node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseNode node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitImmutableArray[Stmt](ImmutableArray`1 elements)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockContents(BlockContents node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseNode node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitEnclosed[BlockContents](Enclosed`1 enclosed)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockExpr(Block node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitBlockBodyFuncBody(BlockBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncBody(FuncBody node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitFuncDecl(Func node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.VisitFuncDecl(Func node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].VisitDecl(Decl node)
at Draco.Compiler.Api.Syntax.ParseTreeVisitorBase`1[[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Visit(ParseNode node)
at Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor.Infer(ParseNode tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.<>c.<InferLocalTypes>b__5_1(TypeInferenceVisitor visitor, ParseNode tree)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ParseNode, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceVisitor, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.Types.TypeInferenceResult, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(TypeInferenceVisitor ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[TypeInferenceVisitor,TypeInferenceResult](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ParseNode,TypeInferenceVisitor,TypeInferenceResult](ParseNode args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.InferLocalTypes(QueryDatabase db, ParseNode tree)
at Draco.Compiler.Internal.Semantics.Types.TypeChecker.GetDiagnostics(QueryDatabase db, ParseNode tree)
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|10_0(ParseNode tree)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.ParseNode, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Draco.Compiler.Api.Semantics.SemanticModel.<GetAllDiagnostics>g__Impl|10_0(ParseNode tree)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream dracoIrStream)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute[Object](Compilation compilation)
at Draco.Compiler.Api.Scripting.ScriptingEngine.Execute(Compilation compilation)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
func main() {
1 = 1;
}
func foo(): int32 {
if ({ return 4 }) {
if (true) {
return 0;
}
else {
return 1;
}
}
}
func main(){
println(foo());
}
func foo(): string{
"1+2"
}
func main(){
println("1 + 2 = \{1 + 2}");
}
func foo() {
if (false) {
lbl:
return;
}
while (false) {
goto lbl;
}
}
func main() {
;
}
func main()
}
func main(){
var x;
x = x();
}
func main() {
func
}
func main() {
println[]
}
func main() {
println("'att't"'"t''ork;");
}
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Draco.Compiler.Api.Syntax.SyntaxNode.TranslateRelativeRange(RelativeRange range)
at Draco.Compiler.Internal.Diagnostics.Location.RelativeToTree.ToApiLocation(SyntaxNode context)
at Draco.Compiler.Internal.Diagnostics.Diagnostic.ToApiDiagnostic(SyntaxNode context)
at Draco.Compiler.Api.Syntax.SyntaxTree.<>c__DisplayClass13_0.<get_Diagnostics>b__1(Diagnostic d)
at System.Linq.Enumerable.SelectListIterator`2[[Draco.Compiler.Internal.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2[[Draco.Compiler.Api.Syntax.SyntaxNode, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Api.Diagnostics.Diagnostic, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Diagnostic](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Diagnostic](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Diagnostic](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Diagnostic](IEnumerable`1 items)
at Draco.Compiler.Api.Compilation.GetSyntaxDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream dracoIrStream)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
https://playground.draco-lang.org/#AksrzUtWyE3MzNPQVKjmUgCCgqLMvJKcPA0l9cSSEvUSJXUl9fyibGslTWuuWi4A
func main() {
println("'att't"'"'ork;");
}
System.NotImplementedException: The method or operation is not implemented.
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstExpr(LiteralExpressionSyntax lit)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass3_0.<ToAstExpr>b__0(ExpressionSyntax expr)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.ExpressionSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, ExpressionSyntax a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.ExpressionSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Expr](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ExpressionSyntax,Unit,Expr](ExpressionSyntax args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[ExpressionSyntax,Expr](ExpressionSyntax args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstExpr(QueryDatabase db, ExpressionSyntax expr)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass2_0.<ToAstStmt>b__0(StatementSyntax stmt)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.StatementSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, StatementSyntax a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.StatementSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Stmt, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Stmt](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[StatementSyntax,Unit,Stmt](StatementSyntax args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[StatementSyntax,Stmt](StatementSyntax args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstStmt(QueryDatabase db, StatementSyntax stmt)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstFuncBody(QueryDatabase db, BlockFunctionBodySyntax body)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass6_0.<ToAstFuncBody>b__0(FunctionBodySyntax funcBody)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.FunctionBodySyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr.Block, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, FunctionBodySyntax a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.FunctionBodySyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Expr.Block, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Block](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[FunctionBodySyntax,Unit,Block](FunctionBodySyntax args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[FunctionBodySyntax,Block](FunctionBodySyntax args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstFuncBody(QueryDatabase db, FunctionBodySyntax funcBody)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass1_0.<ToAstDecl>b__0(DeclarationSyntax decl)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.DeclarationSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, DeclarationSyntax a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.DeclarationSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,Decl](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[DeclarationSyntax,Unit,Decl](DeclarationSyntax args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[DeclarationSyntax,Decl](DeclarationSyntax args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstDecl(QueryDatabase db, DeclarationSyntax decl)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass5_0.<ToAstCompilationUnit>b__1(DeclarationSyntax d)
at System.Linq.Enumerable.SelectEnumerableIterator`2[[Draco.Compiler.Api.Syntax.DeclarationSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1[[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.Decl, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[Decl](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[Decl](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[Decl](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[Decl](IEnumerable`1 items)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.<>c__DisplayClass5_0.<ToAstCompilationUnit>b__0(CompilationUnitSyntax cu)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass4_0`2[[Draco.Compiler.Api.Syntax.CompilationUnitSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__1(Unit _, CompilationUnitSyntax a1)
at Draco.Compiler.Internal.Query.QueryDatabase.<>c__DisplayClass5_0`3[[Draco.Compiler.Api.Syntax.CompilationUnitSyntax, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Utilities.Unit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Draco.Compiler.Internal.Semantics.AbstractSyntax.Ast.CompilationUnit, Draco.Compiler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<GetOrUpdate>b__0(Unit ctx)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdateImpl[Unit,CompilationUnit](String queryName, Object args, Func`1 createContext, Func`2 recompute, Func`2 handleCycle)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[CompilationUnitSyntax,Unit,CompilationUnit](CompilationUnitSyntax args, Func`1 createContext, Func`3 recompute, Func`3 handleCycle, String queryName)
at Draco.Compiler.Internal.Query.QueryDatabase.GetOrUpdate[CompilationUnitSyntax,CompilationUnit](CompilationUnitSyntax args, Func`2 recompute, Func`2 handleCycle, String queryName)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAstCompilationUnit(QueryDatabase db, CompilationUnitSyntax cu)
at Draco.Compiler.Internal.Semantics.AbstractSyntax.SyntaxTreeToAst.ToAst(QueryDatabase db, SyntaxNode ast)
at Draco.Compiler.Api.Semantics.SemanticModel.GetAllDiagnostics()
at Draco.Compiler.Api.Semantics.SemanticModel.get_Diagnostics()
at Draco.Compiler.Api.Compilation.GetSemanticDiagnostics()
at Draco.Compiler.Api.Compilation.GetDiagnostics()
at Draco.Compiler.Api.Compilation.Emit(Stream peStream, Stream dracoIrStream)
at Draco.Editor.Web.Program.RunScript(Compilation compilation)
func main(){
while(x < s)
func something();
func foo(): System = 5;
func main(){
foo
}
func foo() {}
public import Foo
import System.Collections.Immutable;
func main(){
ImmutableArray<int32>.Empt|
}
label:
import System.Console;
func main() {
while(return){}
}
System.NullReferenceException: Object reference not set to an instance of an object.
at Draco.Compiler.Internal.OptimizingIr.FunctionBodyCodegen.BoxIfNeeded(TypeSymbol targetType, IOperand source)
at Draco.Compiler.Internal.OptimizingIr.FunctionBodyCodegen.<VisitCallExpression>b__28_0(ValueTuple`2 pair)
[truncated]
func main() {
label:
var x = goto label;
}
System.NotImplementedException: The method or operation is not implemented.
at Draco.Compiler.Internal.Codegen.MetadataCodegen.EncodeSignatureType(SignatureTypeEncoder encoder, TypeSymbol type)
[truncated]
This issue purpose is to gather parser exceptions that are throwed when parsing snippets of code. Follow the following pattern:
Exception:
Playground