Supervisor (Polyglot)¶
In [ ]:
#r @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstandard2.1/FSharp.Control.AsyncSeq.dll"
#r @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6.0/System.Reactive.dll"
#r @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/netstandard2.0/System.Reactive.Linq.dll"
#r @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll"
#r @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.common/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Common.dll"
#r @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.client/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Client.dll"
#r @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.common/7.0.0/lib/net7.0/Microsoft.AspNetCore.SignalR.Common.dll"
#r @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client/7.0.0/lib/net7.0/Microsoft.AspNetCore.SignalR.Client.dll"
#r @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client.core/7.0.0/lib/net7.0/Microsoft.AspNetCore.SignalR.Client.Core.dll"
#r @"../../../../../../../.nuget/packages/fsharp.json/0.4.1/lib/netstandard2.0/FSharp.Json.dll"
In [ ]:
#!import ../../lib/fsharp/Notebooks.dib
#!import ../../lib/fsharp/Testing.dib
In [ ]:
#!import ../../lib/fsharp/Common.fs
#!import ../../lib/fsharp/CommonFSharp.fs
#!import ../../lib/fsharp/Async.fs
#!import ../../lib/fsharp/AsyncSeq.fs
#!import ../../lib/fsharp/Runtime.fs
#!import ../../lib/fsharp/FileSystem.fs
In [ ]:
#if !INTERACTIVE
open Lib
#endif
In [ ]:
open Common
open SpiralFileSystem.Operators
open Microsoft.AspNetCore.SignalR.Client
sendJson¶
In [ ]:
let inline sendJson (port : int) (json : string) = async {
let host = "127.0.0.1"
let! portOpen = SpiralNetworking.test_port_open host port
if portOpen then
try
let connection = HubConnectionBuilder().WithUrl($"http://{host}:{port}").Build()
do! connection.StartAsync () |> Async.AwaitTask
let! result = connection.InvokeAsync<string> ("ClientToServerMsg", json) |> Async.AwaitTask
do! connection.StopAsync () |> Async.AwaitTask
trace Verbose (fun () -> $"Supervisor.sendJson / port: {port} / json: {json |> SpiralSm.ellipsis_end 200} / result: {result |> Option.ofObj |> Option.map (SpiralSm.ellipsis_end 200)}") _locals
return Some result
with ex ->
trace Critical (fun () -> $"Supervisor.sendJson / port: {port} / json: {json |> SpiralSm.ellipsis_end 200} / ex: {ex |> SpiralSm.format_exception}") _locals
return None
else
trace Debug (fun () -> $"Supervisor.sendJson / port: {port} / error: port not open") _locals
return None
}
sendObj¶
In [ ]:
let inline sendObj port obj =
obj
|> System.Text.Json.JsonSerializer.Serialize
|> sendJson port
VSCPos¶
In [ ]:
type VSCPos = {| line : int; character : int |}
VSCRange¶
In [ ]:
type VSCRange = VSCPos * VSCPos
RString¶
In [ ]:
type RString = VSCRange * string
TracedError¶
In [ ]:
type TracedError = {| trace : string list; message : string |}
ClientErrorsRes¶
In [ ]:
type ClientErrorsRes =
| FatalError of string
| TracedError of TracedError
| PackageErrors of {| uri : string; errors : RString list |}
| TokenizerErrors of {| uri : string; errors : RString list |}
| ParserErrors of {| uri : string; errors : RString list |}
| TypeErrors of {| uri : string; errors : RString list |}
workspaceRoot¶
In [ ]:
let workspaceRoot = SpiralFileSystem.get_workspace_root ()
awaitCompiler¶
In [ ]:
let inline awaitCompiler port cancellationToken = async {
let host = "127.0.0.1"
let struct (ct, disposable) = cancellationToken |> SpiralThreading.new_disposable_token
let! ct = ct |> SpiralAsync.merge_cancellation_token_with_default_async
let compiler = MailboxProcessor.Start (fun inbox -> async {
let! availablePort = SpiralNetworking.get_available_port (Some 180) host port
if availablePort <> port then
inbox.Post (port, false)
else
let compilerPath =
workspaceRoot </> "deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release"
|> System.IO.Path.GetFullPath
let dllPath = compilerPath </> "Spiral.dll"
let! exitCode, result =
SpiralRuntime.execution_options (fun x ->
{ x with
l0 = $@"dotnet ""{dllPath}"" --port {availablePort} --default-int i32 --default-float f64"
l1 = Some ct
l3 = Some (fun struct (_, line, _) -> async {
if line |> SpiralSm.contains $"System.IO.IOException: Failed to bind to address http://{host}:{port}: address already in use." then
inbox.Post (port, false)
if line |> SpiralSm.contains $"Server bound to: http://localhost:{availablePort}" then
let rec loop retry = async {
do!
SpiralNetworking.wait_for_port_access (Some 100) true host availablePort
|> Async.runWithTimeoutAsync 500
|> Async.Ignore
let _locals () = $"port: {availablePort} / retry: {retry} / {_locals ()}"
try
let pingObj = {| Ping = true |}
let! pingResult = pingObj |> sendObj availablePort
trace Verbose (fun () -> $"Supervisor.awaitCompiler / Ping / result: '%A{pingResult}'") _locals
match pingResult with
| Some _ -> inbox.Post (availablePort, true)
| None -> do! loop (retry + 1)
with ex ->
trace Verbose (fun () -> $"Supervisor.awaitCompiler / Ping / ex: {ex |> SpiralSm.format_exception}") _locals
do! loop (retry + 1)
}
do! loop 1
})
l6 = Some workspaceRoot
}
)
|> SpiralRuntime.execute_with_options_async
trace Debug (fun () -> $"Supervisor.awaitCompiler / exitCode: {exitCode} / result: {result}") _locals
disposable.Dispose ()
}, ct)
let! serverPort, managed = compiler.Receive ()
let connection = HubConnectionBuilder().WithUrl($"http://{host}:{serverPort}").Build ()
do! connection.StartAsync () |> Async.AwaitTask
let event = Event<_> ()
let disposable' = connection.On<string> ("ServerToClientMsg", event.Trigger)
let stream =
FSharp.Control.AsyncSeq.unfoldAsync
(fun () -> async {
let! msg = event.Publish |> Async.AwaitEvent
return Some (msg |> FSharp.Json.Json.deserialize<ClientErrorsRes>, ())
})
()
let disposable' =
new_disposable (fun () ->
async {
disposable'.Dispose ()
do! connection.StopAsync () |> Async.AwaitTask
disposable.Dispose ()
if managed
then do!
SpiralNetworking.wait_for_port_access (Some 100) false host serverPort
|> Async.runWithTimeoutAsync 1500
|> Async.Ignore
}
|> Async.RunSynchronously
)
return
serverPort,
stream,
ct,
disposable'
}
getFilePathFromUri¶
In [ ]:
let inline getFilePathFromUri uri =
match System.Uri.TryCreate (uri, System.UriKind.Absolute) with
| true, uri -> uri.AbsolutePath |> System.IO.Path.GetFullPath
| _ -> failwith "invalid uri"
getCompilerPort¶
In [ ]:
let inline getCompilerPort () =
13805
serialize_obj¶
In [ ]:
let serializeObj obj =
try
obj
|> FSharp.Json.Json.serialize
|> SpiralSm.replace "\\\\" "\\"
|> SpiralSm.replace "\\r\\n" "\n"
|> SpiralSm.replace "\\n" "\n"
with ex ->
trace Critical (fun () -> "Supervisor.serialize_obj / obj: %A{obj}") _locals
""
Backend¶
In [ ]:
type Backend =
| Fsharp
| Cuda
buildFile¶
In [ ]:
let inline buildFile backend timeout port cancellationToken path =
let rec loop retry = async {
let fullPath = path |> System.IO.Path.GetFullPath
let fileDir = fullPath |> System.IO.Path.GetDirectoryName
let fileName = fullPath |> System.IO.Path.GetFileNameWithoutExtension
let! code = fullPath |> SpiralFileSystem.read_all_text_async
let stream, disposable = fileDir |> FileSystem.watchDirectory (fun _ -> true)
use _ = disposable
let struct (token, disposable) = SpiralThreading.new_disposable_token cancellationToken
use _ = disposable
let port = port |> Option.defaultWith getCompilerPort
let! serverPort, errors, ct, disposable = awaitCompiler port (Some token)
use _ = disposable
let outputFileName =
match backend with
| Fsharp -> $"{fileName}.fsx"
| Cuda -> $"{fileName}.py"
let outputContentSeq =
stream
|> FSharp.Control.AsyncSeq.chooseAsync (function
| _, (FileSystem.FileSystemChange.Changed (path, Some text))
when (path |> System.IO.Path.GetFileName) = outputFileName
->
// fileDir </> path |> SpiralFileSystem.read_all_text_retry_async
text |> Some |> Async.init
| _ -> None |> Async.init
)
|> FSharp.Control.AsyncSeq.map (fun content ->
Some (content |> SpiralSm.replace "\r\n" "\n"), None
)
let inline printErrorData (data : {| uri : string; errors : RString list |}) =
let fileName = data.uri |> System.IO.Path.GetFileName
let errors =
data.errors
|> List.map snd
|> SpiralSm.concat "\n"
$"{fileName}:\n{errors}"
let errorsSeq =
errors
|> FSharp.Control.AsyncSeq.choose (fun error ->
match error with
| FatalError message ->
Some (message, error)
| TracedError data ->
Some (data.message, error)
| PackageErrors data when data.errors |> List.isEmpty |> not ->
Some (data |> printErrorData, error)
| TokenizerErrors data when data.errors |> List.isEmpty |> not ->
Some (data |> printErrorData, error)
| ParserErrors data when data.errors |> List.isEmpty |> not ->
Some (data |> printErrorData, error)
| TypeErrors data when data.errors |> List.isEmpty |> not ->
Some (data |> printErrorData, error)
| _ -> None
)
|> FSharp.Control.AsyncSeq.map (fun (message, error) ->
None, Some (message, error)
)
let timerSeq =
500
|> FSharp.Control.AsyncSeq.intervalMs
|> FSharp.Control.AsyncSeq.map (fun _ -> None, None)
let outputSeq =
[ outputContentSeq; errorsSeq; timerSeq ]
|> FSharp.Control.AsyncSeq.mergeAll
let! outputChild =
((None, [], 0), outputSeq)
||> FSharp.Control.AsyncSeq.scan (
fun (outputContentResult, errors, typeErrorCount) (outputContent, error) ->
trace Debug (fun () -> $"Supervisor.buildFile / AsyncSeq.scan / path: {path} / errors: {errors |> serializeObj} / outputContentResult: {outputContentResult} / typeErrorCount: {typeErrorCount} / retry: {retry} / error: {error} / outputContent:\n{outputContent |> Option.defaultValue System.String.Empty |> SpiralSm.ellipsis_end 1500}") _locals
match outputContent, error with
| Some outputContent, None -> Some outputContent, errors, typeErrorCount
| None, Some (_, FatalError "File main has a type error somewhere in its path.") ->
outputContentResult, errors, typeErrorCount + 1
| None, Some error -> outputContentResult, error :: errors, typeErrorCount
| None, None when typeErrorCount >= 1 ->
outputContentResult, errors, typeErrorCount + 1
| _ -> outputContentResult, errors, typeErrorCount
)
|> FSharp.Control.AsyncSeq.takeWhileInclusive (fun (outputContent, errors, typeErrorCount) ->
trace Debug (fun () -> $"Supervisor.buildFile / takeWhileInclusive / path: {path} / errors: {errors |> serializeObj} / typeErrorCount: {typeErrorCount} / retry: {retry} / outputContent:\n{outputContent |> Option.defaultValue System.String.Empty |> SpiralSm.ellipsis_end 1500}") _locals
#if INTERACTIVE
let errorWait = 2
#else
let errorWait = 2
#endif
match outputContent, errors with
| None, [] when typeErrorCount > errorWait -> false
| None, [] -> true
| _ -> false
)
|> FSharp.Control.AsyncSeq.tryLast
|> Async.withCancellationToken ct
|> Async.catch
|> Async.runWithTimeoutAsync timeout
|> Async.StartChild
// do! Async.Sleep 60
let fullPathUri = fullPath |> SpiralFileSystem.normalize_path |> SpiralFileSystem.new_file_uri
let fileOpenObj = {| FileOpen = {| uri = fullPathUri; spiText = code |} |}
let! _fileOpenResult = fileOpenObj |> sendObj serverPort
// do! Async.Sleep 60
let backendId =
match backend with
| Fsharp -> "Fsharp"
| Cuda -> "Python + Cuda"
let buildFileObj = {| BuildFile = {| uri = fullPathUri; backend = backendId |} |}
let! _buildFileResult = buildFileObj |> sendObj serverPort
let! result, typeErrorCount =
outputChild
|> Async.map (function
| Some (Ok (Some (outputCode, errors, typeErrorCount))) ->
(outputCode, errors |> List.distinct |> List.rev), typeErrorCount
| Some (Error ex) ->
trace Critical (fun () -> $"Supervisor.buildFile / error: {ex |> SpiralSm.format_exception} / retry: {retry}") _locals
(None, []), 0
| _ -> (None, []), 0
)
match result with
| None, _ when typeErrorCount > 0 && retry = 0 ->
return! loop (retry + 1)
| _ ->
if fileDir |> SpiralSm.starts_with (workspaceRoot </> "target") then
let fileDirUri = fileDir |> SpiralFileSystem.normalize_path |> SpiralFileSystem.new_file_uri
let fileDeleteObj = {| FileDelete = {| uris = [| fileDirUri |] |} |}
let! _fileDeleteResult = fileDeleteObj |> sendObj serverPort
()
let outputPath = fileDir </> outputFileName
return outputPath, result
}
loop 0
SpiralInput¶
In [ ]:
type SpiralInput =
| Spi of string * string option
| Spir of string
persistCode¶
In [ ]:
let inline persistCode (input: {| backend : Backend option; input: SpiralInput; packages: string [] |}) = async {
let targetDir = workspaceRoot </> "target/spiral_Eval"
let packagesDir = targetDir </> "packages"
let hashHex = $"%A{input.backend}%A{input.input}" |> SpiralCrypto.hash_text
let packageDir = packagesDir </> hashHex
packageDir |> System.IO.Directory.CreateDirectory |> ignore
let moduleName = "main"
let spirModule, spiModule =
match input.input with
| Spi (spi, Some spir) -> true, true
| Spi (spi, None) -> false, true
| Spir spir -> true, false
|> fun (spir, spi) ->
(if spir then $"{moduleName}_real*-" else ""),
if spi then moduleName else ""
let libLinkTargetPath = workspaceRoot </> "lib/spiral"
let libLinkPath = packageDir </> "spiral"
let packagesModule =
input.packages
|> Array.map (fun package ->
let path = workspaceRoot </> package
let packageName = path |> System.IO.Path.GetFileName
let libLinkPath = packageDir </> packageName
libLinkPath |> SpiralFileSystem.link_directory path
$"{packageName}-"
)
|> String.concat "\n "
let packageDir' =
if input.packages |> Array.isEmpty
then workspaceRoot </> "lib"
else
libLinkPath |> SpiralFileSystem.link_directory libLinkTargetPath
packageDir
let spiprojPath = packageDir </> "package.spiproj"
let spiprojCode =
$"""packageDir: {packageDir'}
packages:
|core-
spiral-
{packagesModule}
modules:
{spirModule}
{spiModule}
"""
do! spiprojCode |> SpiralFileSystem.write_all_text_exists spiprojPath
let spirPath = packageDir </> $"{moduleName}_real.spir"
let spiPath = packageDir </> $"{moduleName}.spi"
let spirCode, spiCode =
match input.input with
| Spi (spi, Some spir) -> Some spir, Some spi
| Spi (spi, None) -> None, Some spi
| Spir spir -> Some spir, None
match spirCode with
| Some spir -> do! spir |> SpiralFileSystem.write_all_text_exists spirPath
| None -> ()
match spiCode with
| Some spi -> do! spi |> SpiralFileSystem.write_all_text_exists spiPath
| None -> ()
let spiralPath =
match input.input with
| Spi _ -> spiPath
| Spir _ -> spirPath
match input.backend with
| None -> return spiralPath, None
| Some backend ->
let outputFileName =
let fileName =
match input.input with
| Spi _ -> moduleName
| Spir _ -> $"{moduleName}_real"
match backend with
| Fsharp -> $"{fileName}.fsx"
| Cuda -> $"{fileName}.py"
let outputPath = packageDir </> outputFileName
if outputPath |> System.IO.File.Exists |> not
then return spiralPath, None
else
let! oldCode = spiralPath |> SpiralFileSystem.read_all_text_async
if oldCode <> (spiCode |> Option.defaultValue (spirCode |> Option.defaultValue ""))
then return spiralPath, None
else
let! outputCode = outputPath |> SpiralFileSystem.read_all_text_async
return spiralPath, Some (outputPath, outputCode |> SpiralSm.replace "\r\n" "\n")
}
buildCode¶
In [ ]:
let buildCode backend packages isCache timeout cancellationToken input = async {
let! mainPath, outputCache =
persistCode {| input = input; backend = Some backend; packages = packages |}
match outputCache with
| Some (outputPath, outputCode) when isCache -> return mainPath, (outputPath, Some outputCode), []
| _ ->
let! outputPath, (outputCode, errors) = mainPath |> buildFile backend timeout None cancellationToken
return mainPath, (outputPath, outputCode), errors
}
In [ ]:
//// test
"""inl app () =
console.write_line "text"
1i32
inl main () =
app
|> dyn
|> ignore
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 15000 None
|> Async.runWithTimeout 15000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
Some """let rec closure1 () () : unit =
let v0 : (string -> unit) = System.Console.WriteLine
let v1 : string = "text"
v0 v1
and closure0 () () : int32 =
let v0 : unit = ()
let v1 : (unit -> unit) = closure1()
let v2 : unit = (fun () -> v1 (); v0) ()
1
let v0 : (unit -> int32) = closure0()
()
""",
[]
)
)
00:00:09 v #1 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:07 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:10 v #2 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:08 v #2 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:08 v #3 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:08 v #4 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:10 v #3 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #4 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #5 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #6 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #7 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #8 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #9 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #10 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #11 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #12 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #13 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #14 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #15 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #16 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #17 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #18 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #19 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #20 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #21 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #22 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:08 v #5 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:10 v #23 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #24 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:10 v #25 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:05 v #1 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:05 v #2 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:08 v #6 > Server bound to: http://localhost:13805 00:00:05 d #3 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:06 d #4 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:06 d #5 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:06 v #6 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl app () =\n console.write_line \u0022text\u0022\n 1i32\n\ninl main ...et/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi"}} / result: 00:00:06 v #7 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi"}} / result: 00:00:06 d #8 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:06 d #9 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:07 d #10 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:07 d #11 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:07 d #12 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:07 d #13 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:08 d #14 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:08 d #15 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:08 d #16 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:08 d #17 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:08 d #18 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: let rec closure1 () () : unit = let v0 : (string -> unit) = System.Console.WriteLine let v1 : string = "text" v0 v1 and closure0 () () : int32 = let v0 : unit = () let v1 : (unit -> unit) = closure1() let v2 : unit = (fun () -> v1 (); v0) () 1 let v0 : (unit -> int32) = closure0() () 00:00:08 d #19 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: let rec closure1 () () : unit = let v0 : (string -> unit) = System.Console.WriteLine let v1 : string = "text" v0 v1 and closure0 () () : int32 = let v0 : unit = () let v1 : (unit -> unit) = closure1() let v2 : unit = (fun () -> v1 (); v0) () 1 let v0 : (unit -> int32) = closure0() () 00:00:08 v #20 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6"]}} / result: 00:00:13 v #26 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:08 d #21 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (Some "let rec closure1 () () : unit = let v0 : (string -> unit) = System.Console.WriteLine let v1 : string = "text" v0 v1 and closure0 () () : int32 = let v0 : unit = () let v1 : (unit -> unit) = closure1() let v2 : unit = (fun () -> v1 (); v0) () 1 let v0 : (unit -> int32) = closure0() () ", [])
In [ ]:
//// test
""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[ "Cannot find `main` in file main." ]
)
)
00:00:13 v #27 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:11 d #7 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:13 v #28 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #29 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:11 v #8 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:11 v #9 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:11 v #10 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:13 v #30 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #31 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #32 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #33 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #34 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:13 v #35 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #36 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #37 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #38 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #39 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #40 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #41 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #42 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #43 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #44 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #45 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #46 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #47 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #48 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #49 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #50 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #51 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #52 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #53 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:12 v #11 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:14 v #54 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 v #55 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:09 v #22 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:09 v #23 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:12 v #12 > Server bound to: http://localhost:13805 00:00:09 d #24 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:09 d #25 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:09 d #26 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:09 v #27 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi"}} / result: 00:00:09 v #28 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi"}} / result: 00:00:10 d #29 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:10 d #30 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:10 d #31 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:10 d #32 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:11 d #33 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:11 d #34 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:11 d #35 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:11 d #36 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:12 d #37 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((Cannot find `main` in file main., FatalError "Cannot find `main` in file main.")) / outputContent: 00:00:12 d #38 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi / errors: [ [ "Cannot find `main` in file main.", { "FatalError": "Cannot find `main` in file main." } ] ] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:12 v #39 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa"]}} / result: 00:00:16 v #56 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:12 d #40 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["Cannot find `main` in file main."])
In [ ]:
//// test
"""inl main () =
1i32 / 0i32
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[ "An attempt to divide by zero has been detected at compile time." ]
)
)
00:00:17 v #57 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:14 d #13 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:17 v #58 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #59 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:15 v #14 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:15 v #15 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:15 v #16 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:17 v #60 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #61 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #62 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #63 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #64 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #65 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #66 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #67 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #68 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #69 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #70 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #71 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #72 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #73 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #74 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #75 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #76 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #77 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #78 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #79 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:15 v #17 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:17 v #80 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #81 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 v #82 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:12 v #41 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:12 v #42 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:15 v #18 > Server bound to: http://localhost:13805 00:00:12 d #43 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:12 d #44 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:12 d #45 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:12 v #46 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () =\n 1i32 / 0i32\n","uri":"file:///home/runner/work/polyglot/p...et/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi"}} / result: 00:00:12 v #47 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi"}} / result: 00:00:13 d #48 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:13 d #49 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:13 d #50 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:13 d #51 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:14 d #52 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:14 d #53 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:14 d #54 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:14 d #55 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:15 d #56 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((An attempt to divide by zero has been detected at compile time., TracedError { message = "An attempt to divide by zero has been detected at compile time." trace = ["Error trace on line: 1, column: 10 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi. inl main () = ^ "; "Error trace on line: 2, column: 5 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi. 1i32 / 0i32 ^ "] })) / outputContent: 00:00:15 d #57 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi / errors: [ [ "An attempt to divide by zero has been detected at compile time.", { "TracedError": { "message": "An attempt to divide by zero has been detected at compile time.", "trace": [ "Error trace on line: 1, column: 10 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi. inl main () = ^ ", "Error trace on line: 2, column: 5 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi. 1i32 / 0i32 ^ " ] } } ] ] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:15 v #58 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2"]}} / result: 00:00:20 v #83 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:15 d #59 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["An attempt to divide by zero has been detected at compile time."])
In [ ]:
//// test
"""inl main () =
1 + ""
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[
"main.spi:
Constraint satisfaction error.
Got: string
Fails to satisfy: number"
]
)
)
00:00:20 v #84 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:17 d #19 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:20 v #85 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #86 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:18 v #20 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:18 v #21 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:18 v #22 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:20 v #87 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #88 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #89 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #90 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #91 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #92 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #93 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #94 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #95 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #96 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #97 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #98 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #99 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #100 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #101 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #102 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #103 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #104 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #105 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #106 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #107 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:18 v #23 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:20 v #108 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:20 v #109 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:15 v #60 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:15 v #61 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:18 v #24 > Server bound to: http://localhost:13805 00:00:15 d #62 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:15 d #63 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:15 d #64 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:15 v #65 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () =\n 1 \u002B \u0022\u0022\n","uri":"file:///home/runner/work/...et/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi"}} / result: 00:00:15 v #66 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi"}} / result: 00:00:16 d #67 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:16 d #68 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:16 d #69 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:16 d #70 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:17 d #71 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:17 d #72 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:17 d #73 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:17 d #74 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:18 d #75 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((File main has a type error somewhere in its path., FatalError "File main has a type error somewhere in its path.")) / outputContent: 00:00:18 d #76 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 1 / retry: 0 / outputContent: 00:00:18 d #77 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 1 / retry: 0 / error: Some((main.spi: Constraint satisfaction error. Got: string Fails to satisfy: number, TypeErrors { errors = [(({ character = 8 line = 1 }, { character = 10 line = 1 }), "Constraint satisfaction error. Got: string Fails to satisfy: number")] uri = "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })) / outputContent: 00:00:18 d #78 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [ [ "main.spi: Constraint satisfaction error. Got: string Fails to satisfy: number", { "TypeErrors": { "errors": [ [ [ { "character": 8, "line": 1 }, { "character": 10, "line": 1 } ], "Constraint satisfaction error. Got: string Fails to satisfy: number" ] ], "uri": "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" } } ] ] / typeErrorCount: 1 / retry: 0 / outputContent: 00:00:23 v #110 networking.test_port_open / { port = 13806; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:18 d #79 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:18 d #80 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 1 / error: / outputContent: 00:00:18 d #81 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:18 v #82 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () =\n 1 \u002B \u0022\u0022\n","uri":"file:///home/runner/work/...et/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi"}} / result: 00:00:18 v #83 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi"}} / result: 00:00:18 d #84 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 1 / error: Some((main.spi: Constraint satisfaction error. Got: string Fails to satisfy: number, TypeErrors { errors = [(({ character = 8 line = 1 }, { character = 10 line = 1 }), "Constraint satisfaction error. Got: string Fails to satisfy: number")] uri = "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })) / outputContent: 00:00:18 d #85 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi / errors: [ [ "main.spi: Constraint satisfaction error. Got: string Fails to satisfy: number", { "TypeErrors": { "errors": [ [ [ { "character": 8, "line": 1 }, { "character": 10, "line": 1 } ], "Constraint satisfaction error. Got: string Fails to satisfy: number" ] ], "uri": "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" } } ] ] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:18 v #86 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0"]}} / result: 00:00:18 d #87 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite 00:00:23 v #111 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:18 d #88 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["main.spi: Constraint satisfaction error. Got: string Fails to satisfy: number"])
In [ ]:
//// test
"""inl main () =
x + y
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[
"main.spi:
Unbound variable: x.
Unbound variable: y."
]
)
)
00:00:23 v #112 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 d #25 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:23 v #113 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #114 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 v #26 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:21 v #27 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:21 v #28 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:23 v #115 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #116 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #117 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #118 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #119 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #120 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #121 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #122 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #123 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #124 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #125 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #126 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #127 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #128 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #129 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #130 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #131 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #132 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #133 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #134 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 v #29 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:23 v #135 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #136 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 v #137 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:19 v #89 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:19 v #90 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:21 v #30 > Server bound to: http://localhost:13805 00:00:19 d #91 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:19 d #92 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:19 d #93 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:19 v #94 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () =\n x \u002B y\n","uri":"file:///home/runner/work/polyglot/po...et/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi"}} / result: 00:00:19 v #95 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi"}} / result: 00:00:19 d #96 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:19 d #97 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:20 d #98 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:20 d #99 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:20 d #100 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:20 d #101 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:21 d #102 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:21 d #103 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:21 d #104 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((File main has a type error somewhere in its path., FatalError "File main has a type error somewhere in its path.")) / outputContent: 00:00:21 d #105 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 1 / retry: 0 / outputContent: 00:00:21 d #106 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 1 / retry: 0 / error: Some((main.spi: Unbound variable: x. Unbound variable: y., TypeErrors { errors = [(({ character = 4 line = 1 }, { character = 5 line = 1 }), "Unbound variable: x."); (({ character = 8 line = 1 }, { character = 9 line = 1 }), "Unbound variable: y.")] uri = "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })) / outputContent: 00:00:21 d #107 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [ [ "main.spi: Unbound variable: x. Unbound variable: y.", { "TypeErrors": { "errors": [ [ [ { "character": 4, "line": 1 }, { "character": 5, "line": 1 } ], "Unbound variable: x." ], [ [ { "character": 8, "line": 1 }, { "character": 9, "line": 1 } ], "Unbound variable: y." ] ], "uri": "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" } } ] ] / typeErrorCount: 1 / retry: 0 / outputContent: 00:00:25 v #138 networking.test_port_open / { port = 13806; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 d #108 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:21 d #109 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 1 / error: / outputContent: 00:00:21 d #110 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:21 v #111 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () =\n x \u002B y\n","uri":"file:///home/runner/work/polyglot/po...et/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi"}} / result: 00:00:21 v #112 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi"}} / result: 00:00:21 d #113 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 1 / error: Some((main.spi: Unbound variable: x. Unbound variable: y., TypeErrors { errors = [(({ character = 4 line = 1 }, { character = 5 line = 1 }), "Unbound variable: x."); (({ character = 8 line = 1 }, { character = 9 line = 1 }), "Unbound variable: y.")] uri = "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })) / outputContent: 00:00:21 d #114 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi / errors: [ [ "main.spi: Unbound variable: x. Unbound variable: y.", { "TypeErrors": { "errors": [ [ [ { "character": 4, "line": 1 }, { "character": 5, "line": 1 } ], "Unbound variable: x." ], [ [ { "character": 8, "line": 1 }, { "character": 9, "line": 1 } ], "Unbound variable: y." ] ], "uri": "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" } } ] ] / typeErrorCount: 0 / retry: 1 / outputContent: 00:00:21 v #115 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1"]}} / result: 00:00:21 d #116 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite 00:00:26 v #139 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 d #117 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["main.spi: Unbound variable: x. Unbound variable: y."])
In [ ]:
//// test
"""
inl main () =
real
inl unbox_real forall a. (obj : a) : a =
typecase obj with
| _ => obj
unbox_real ()
()
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[ "Cannot apply a forall with a term." ]
)
)
00:00:26 v #140 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:23 d #31 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:26 v #141 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #142 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:24 v #32 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:24 v #33 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:24 v #34 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:26 v #143 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #144 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #145 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #146 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #147 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #148 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #149 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #150 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #151 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #152 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #153 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #154 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #155 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #156 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #157 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #158 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #159 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #160 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #161 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #162 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:24 v #35 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:26 v #163 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #164 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:26 v #165 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:21 v #118 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:21 v #119 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:24 v #36 > Server bound to: http://localhost:13805 00:00:21 d #120 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:21 d #121 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:21 d #122 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:21 v #123 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"\ninl main () =\n real\n inl unbox_real forall a. (obj : a) : a =\...et/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi"}} / result: 00:00:21 v #124 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi"}} / result: 00:00:22 d #125 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:22 d #126 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:22 d #127 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:22 d #128 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:23 d #129 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:23 d #130 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:23 d #131 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:23 d #132 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:24 d #133 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:24 d #134 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:24 d #135 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((Cannot apply a forall with a term., TracedError { message = "Cannot apply a forall with a term." trace = ["Error trace on line: 2, column: 10 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. inl main () = ^ "; "Error trace on line: 4, column: 9 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. inl unbox_real forall a. (obj : a) : a = ^ "; "Error trace on line: 7, column: 9 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. unbox_real () ^ "] })) / outputContent: 00:00:24 d #136 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi / errors: [ [ "Cannot apply a forall with a term.", { "TracedError": { "message": "Cannot apply a forall with a term.", "trace": [ "Error trace on line: 2, column: 10 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. inl main () = ^ ", "Error trace on line: 4, column: 9 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. inl unbox_real forall a. (obj : a) : a = ^ ", "Error trace on line: 7, column: 9 in module: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi. unbox_real () ^ " ] } } ] ] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:24 v #137 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a"]}} / result: 00:00:29 v #166 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:24 d #138 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["Cannot apply a forall with a term."])
In [ ]:
//// test
"""
inl main () =
real
inl unbox_real forall a. (obj : a) : a =
typecase obj with
| _ => obj
unbox_real `i32 1
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
None,
[ "The main function should not have a forall." ]
)
)
00:00:29 v #167 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:27 d #37 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:29 v #168 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #169 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:27 v #38 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:27 v #39 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:27 v #40 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:29 v #170 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #171 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #172 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #173 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #174 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #175 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #176 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #177 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #178 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #179 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #180 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #181 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #182 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #183 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #184 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #185 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #186 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #187 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #188 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #189 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:27 v #41 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:29 v #190 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #191 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:29 v #192 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:25 v #139 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:25 v #140 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:27 v #42 > Server bound to: http://localhost:13805 00:00:25 d #141 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:25 d #142 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:25 d #143 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:25 v #144 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"\ninl main () =\n real\n inl unbox_real forall a. (obj : a) : a =\...et/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi"}} / result: 00:00:25 v #145 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi"}} / result: 00:00:25 d #146 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:25 d #147 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:26 d #148 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:26 d #149 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:26 d #150 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:26 d #151 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:27 d #152 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:27 d #153 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:27 d #154 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: Some((The main function should not have a forall., TracedError { message = "The main function should not have a forall." trace = [] })) / outputContent: 00:00:27 d #155 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi / errors: [ [ "The main function should not have a forall.", { "TracedError": { "message": "The main function should not have a forall.", "trace": [] } } ] ] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:27 v #156 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f"]}} / result: 00:00:32 v #193 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:27 d #157 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (None, ["The main function should not have a forall."])
In [ ]:
//// test
"""
inl init_series start end inc =
inl total : f64 = conv ((end - start) / inc) + 1
listm.init total (conv >> (*) inc >> (+) start) : list f64
type integration = (f64 -> f64) -> f64 -> f64 -> f64
inl integral dt : integration =
fun f a b =>
init_series (a + dt / 2) (b - dt / 2) dt
|> listm.map (f >> (*) dt)
|> listm.fold (+) 0
inl main () =
integral 0.1 (fun x => x ** 2) 0 1
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
Some "0.3325000000000001\n",
[]
)
)
00:00:32 v #194 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:30 d #43 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:32 v #195 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #196 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:30 v #44 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:30 v #45 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:30 v #46 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:32 v #197 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #198 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #199 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #200 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #201 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #202 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #203 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #204 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #205 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #206 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #207 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #208 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #209 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:32 v #210 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #211 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #212 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #213 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #214 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #215 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #216 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:30 v #47 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:33 v #217 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #218 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #219 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #220 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:28 v #158 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:28 v #159 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:31 v #48 > Server bound to: http://localhost:13805 00:00:28 d #160 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:28 d #161 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:28 d #162 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:28 v #163 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"\ninl init_series start end inc =\n inl total : f64 = conv ((end - start)...et/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi"}} / result: 00:00:28 v #164 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi"}} / result: 00:00:28 d #165 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:28 d #166 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:29 d #167 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:29 d #168 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:29 d #169 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:29 d #170 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:30 d #171 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:30 d #172 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:30 d #173 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 0.3325000000000001 00:00:30 d #174 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 0.3325000000000001 00:00:30 v #175 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db"]}} / result: 00:00:35 v #221 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:30 d #176 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (Some "0.3325000000000001 ", [])
In [ ]:
//// test
"""
inl init_series start end inc =
inl total : f64 = conv ((end - start) / inc) + 1
listm.init total (conv >> (*) inc >> (+) start) : list f64
type integration = (f64 -> f64) -> f64 -> f64 -> f64
inl integral dt : integration =
fun f a b =>
init_series (a + dt / 2) (b - dt / 2) dt
|> listm.map (f >> (*) dt)
|> listm.fold (+) 0
inl main () =
integral 0.1 (fun x => x ** 2) 0 1
"""
|> fun code -> Spi (code, None)
|> buildCode Cuda [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
Some @"kernel = r""""""
""""""
class static_array():
def __init__(self, length):
self.ptr = []
for _ in range(length):
self.ptr.append(None)
def __getitem__(self, index):
assert 0 <= index < len(self.ptr), ""The get index needs to be in range.""
return self.ptr[index]
def __setitem__(self, index, value):
assert 0 <= index < len(self.ptr), ""The set index needs to be in range.""
self.ptr[index] = value
class static_array_list(static_array):
def __init__(self, length):
super().__init__(length)
self.length = 0
def __getitem__(self, index):
assert 0 <= index < self.length, ""The get index needs to be in range.""
return self.ptr[index]
def __setitem__(self, index, value):
assert 0 <= index < self.length, ""The set index needs to be in range.""
self.ptr[index] = value
def push(self,value):
assert (self.length < len(self.ptr)), ""The length before pushing has to be less than the maximum length of the array.""
self.ptr[self.length] = value
self.length += 1
def pop(self):
assert (0 < self.length), ""The length before popping has to be greater than 0.""
self.length -= 1
return self.ptr[self.length]
def unsafe_set_length(self,i):
assert 0 <= i <= len(self.ptr), ""The new length has to be in range.""
self.length = i
class dynamic_array(static_array):
pass
class dynamic_array_list(static_array_list):
def length_(self): return self.length
import cupy as cp
import numpy as np
from dataclasses import dataclass
from typing import NamedTuple, Union, Callable, Tuple
i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str
cuda = False
def main_body():
return 0.3325000000000001
def main():
r = main_body()
if cuda: cp.cuda.get_current_stream().synchronize() # This line is here so the `__trap()` calls on the kernel aren't missed.
return r
if __name__ == '__main__': result = main(); None if result is None else print(result)
",
[]
)
)
00:00:35 v #222 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 d #49 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:35 v #223 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:35 v #224 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:33 v #50 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:33 v #51 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:33 v #52 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:35 v #225 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #226 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #227 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #228 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #229 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #230 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #231 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #232 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #233 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #234 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #235 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #236 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #237 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #238 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #239 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #240 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #241 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #242 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #243 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #244 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #245 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:34 v #53 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:36 v #246 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 v #247 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:31 v #177 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:31 v #178 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:34 v #54 > Server bound to: http://localhost:13805 00:00:31 d #179 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:31 d #180 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:31 d #181 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:31 v #182 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"\ninl init_series start end inc =\n inl total : f64 = conv ((end - start)...et/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi"}} / result: 00:00:31 v #183 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Python \u002B Cuda","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi"}} / result: 00:00:32 d #184 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:32 d #185 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:32 d #186 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:32 d #187 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:33 d #188 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:33 d #189 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:33 d #190 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:33 d #191 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:34 d #192 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:34 d #193 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:34 d #194 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: kernel = r""" """ class static_array(): def __init__(self, length): self.ptr = [] for _ in range(length): self.ptr.append(None) def __getitem__(self, index): assert 0 <= index < len(self.ptr), "The get index needs to be in range." return self.ptr[index] def __setitem__(self, index, value): assert 0 <= index < len(self.ptr), "The set index needs to be in range." self.ptr[index] = value class static_array_list(static_array): def __init__(self, length): super().__init__(length) self.length = 0 def __getitem__(self, index): assert 0 <= index < self.length, "The get index needs to be in range." return self.ptr[index] d...nge." self.length = i class dynamic_array(static_array): pass class dynamic_array_list(static_array_list): def length_(self): return self.length import cupy as cp import numpy as np from dataclasses import dataclass from typing import NamedTuple, Union, Callable, Tuple i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str cuda = False def main_body(): return 0.3325000000000001 def main(): r = main_body() if cuda: cp.cuda.get_current_stream().synchronize() # This line is here so the `__trap()` calls on the kernel aren't missed. return r if __name__ == '__main__': result = main(); None if result is None else print(result) 00:00:34 d #195 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: kernel = r""" """ class static_array(): def __init__(self, length): self.ptr = [] for _ in range(length): self.ptr.append(None) def __getitem__(self, index): assert 0 <= index < len(self.ptr), "The get index needs to be in range." return self.ptr[index] def __setitem__(self, index, value): assert 0 <= index < len(self.ptr), "The set index needs to be in range." self.ptr[index] = value class static_array_list(static_array): def __init__(self, length): super().__init__(length) self.length = 0 def __getitem__(self, index): assert 0 <= index < self.length, "The get index needs to be in range." return self.ptr[index] d...nge." self.length = i class dynamic_array(static_array): pass class dynamic_array_list(static_array_list): def length_(self): return self.length import cupy as cp import numpy as np from dataclasses import dataclass from typing import NamedTuple, Union, Callable, Tuple i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str cuda = False def main_body(): return 0.3325000000000001 def main(): r = main_body() if cuda: cp.cuda.get_current_stream().synchronize() # This line is here so the `__trap()` calls on the kernel aren't missed. return r if __name__ == '__main__': result = main(); None if result is None else print(result) 00:00:34 v #196 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/ca288d6928a8e761855210f25f97fdc056ee1f21be4a24b26e8533ec368831c8"]}} / result: 00:00:38 v #248 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:34 d #197 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (Some "kernel = r""" """ class static_array(): def __init__(self, length): self.ptr = [] for _ in range(length): self.ptr.append(None) def __getitem__(self, index): assert 0 <= index < len(self.ptr), "The get index needs to be in range." return self.ptr[index] def __setitem__(self, index, value): assert 0 <= index < len(self.ptr), "The set index needs to be in range." self.ptr[index] = value class static_array_list(static_array): def __init__(self, length): super().__init__(length) self.length = 0 def __getitem__(self, index): assert 0 <= index < self.length, "The get index needs to be in range." return self.ptr[index] def __setitem__(self, index, value): assert 0 <= index < self.length, "The set index needs to be in range." self.ptr[index] = value def push(self,value): assert (self.length < len(self.ptr)), "The length before pushing has to be less than the maximum length of the array." self.ptr[self.length] = value self.length += 1 def pop(self): assert (0 < self.length), "The length before popping has to be greater than 0." self.length -= 1 return self.ptr[self.length] def unsafe_set_length(self,i): assert 0 <= i <= len(self.ptr), "The new length has to be in range." self.length = i class dynamic_array(static_array): pass class dynamic_array_list(static_array_list): def length_(self): return self.length import cupy as cp import numpy as np from dataclasses import dataclass from typing import NamedTuple, Union, Callable, Tuple i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str cuda = False def main_body(): return 0.3325000000000001 def main(): r = main_body() if cuda: cp.cuda.get_current_stream().synchronize() # This line is here so the `__trap()` calls on the kernel aren't missed. return r if __name__ == '__main__': result = main(); None if result is None else print(result) ", [])
In [ ]:
//// test
"""
inl init_series start end inc =
inl total : f64 = conv ((end - start) / inc) + 1
listm.init total (conv >> (*) inc >> (+) start) : list f64
type integration = (f64 -> f64) -> f64 -> f64 -> f64
inl integral dt : integration =
fun f a b =>
init_series (a + dt / 2) (b - dt / 2) dt
|> listm.map (f >> (*) dt)
|> listm.fold (+) 0
inl main () =
integral 0.01 (fun x => x ** 2) 0 1
"""
|> fun code -> Spi (code, None)
|> buildCode Fsharp [||] false 10000 None
|> Async.runWithTimeout 10000
|> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> List.map fst)
|> _assertEqual (
Some (
Some "0.33332500000000004\n",
[]
)
)
// |> _assertEqual None
// |> fun x -> printfn $"{x.ToDisplayString ()}"
00:00:39 v #249 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:36 d #55 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:buildCode@7-93>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:39 v #250 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #251 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:37 v #56 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:37 v #57 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:37 v #58 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:39 v #252 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #253 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #254 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #255 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #256 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #257 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #258 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #259 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #260 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #261 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #262 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #263 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #264 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #265 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #266 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #267 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #268 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #269 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #270 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #271 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:37 v #59 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:39 v #272 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #273 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:39 v #274 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:34 v #198 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:34 v #199 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:37 v #60 > Server bound to: http://localhost:13805 00:00:34 d #200 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:34 d #201 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:34 d #202 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:34 v #203 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"\ninl init_series start end inc =\n inl total : f64 = conv ((end - start)...et/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi"}} / result: 00:00:34 v #204 Supervisor.sendJson / port: 13805 / json: {"BuildFile":{"backend":"Fsharp","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi"}} / result: 00:00:35 d #205 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:35 d #206 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:35 d #207 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:35 d #208 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:36 d #209 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:36 d #210 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:36 d #211 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:36 d #212 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:37 d #213 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 00:00:37 d #214 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 00:00:37 d #215 Supervisor.buildFile / AsyncSeq.scan / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / outputContentResult: / typeErrorCount: 0 / retry: 0 / error: / outputContent: 0.33332500000000004 00:00:37 d #216 Supervisor.buildFile / takeWhileInclusive / path: /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi / errors: [] / typeErrorCount: 0 / retry: 0 / outputContent: 0.33332500000000004 00:00:37 v #217 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4"]}} / result: 00:00:42 v #275 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:37 d #218 FileSystem.watchWithFilter / Disposing watch stream / filter: FileName, LastWrite Some (Some "0.33332500000000004 ", [])
getFileTokenRange¶
In [ ]:
let inline getFileTokenRange port cancellationToken path = async {
let fullPath = path |> System.IO.Path.GetFullPath
let! code = fullPath |> SpiralFileSystem.read_all_text_async
let lines = code |> SpiralSm.split "\n"
let struct (token, disposable) = SpiralThreading.new_disposable_token cancellationToken
use _ = disposable
let port = port |> Option.defaultWith getCompilerPort
let! serverPort, _errors, ct, disposable = awaitCompiler port (Some token)
use _ = disposable
let fullPathUri = fullPath |> SpiralFileSystem.normalize_path |> SpiralFileSystem.new_file_uri
let fileOpenObj = {| FileOpen = {| uri = fullPathUri; spiText = code |} |}
let! _fileOpenResult = fileOpenObj |> sendObj serverPort
// do! Async.Sleep 60
let fileTokenRangeObj =
{|
FileTokenRange =
{|
uri = fullPathUri
range =
[|
{| line = 0; character = 0 |}
{| line = lines.Length - 1; character = lines.[lines.Length - 1].Length |}
|]
|}
|}
let! fileTokenRangeResult =
fileTokenRangeObj
|> sendObj serverPort
|> Async.withCancellationToken ct
let fileDir = fullPath |> System.IO.Path.GetDirectoryName
if fileDir |> SpiralSm.starts_with (workspaceRoot </> "target") then
let fileDirUri = fileDir |> SpiralFileSystem.normalize_path |> SpiralFileSystem.new_file_uri
let fileDeleteObj = {| FileDelete = {| uris = [| fileDirUri |] |} |}
let! _fileDeleteResult = fileDeleteObj |> sendObj serverPort
()
return fileTokenRangeResult |> Option.map FSharp.Json.Json.deserialize<int array>
}
getCodeTokenRange¶
In [ ]:
let inline getCodeTokenRange cancellationToken code = async {
let! mainPath, _ =
persistCode {| input = Spi (code, None); backend = None; packages = [||] |}
let codeDir = mainPath |> System.IO.Path.GetDirectoryName
let tokensPath = codeDir </> "tokens.json"
let! tokens = async {
if tokensPath |> System.IO.File.Exists |> not
then return None
else
let! text = tokensPath |> SpiralFileSystem.read_all_text_async
return
if text.Length > 2
then text |> FSharp.Json.Json.deserialize<int array> |> Some
else None
}
match tokens with
| Some tokens ->
return tokens |> Some
| None -> return! mainPath |> getFileTokenRange None cancellationToken
}
In [ ]:
//// test
"""inl main () = ()"""
|> getCodeTokenRange None
|> Async.runWithTimeout 10000
|> Option.flatten
|> _assertEqual (Some [| 0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; 8; 0; 0; 2; 1; 4; 0; 0;
2; 1; 8; 0; 0; 1; 1; 8; 0 |])
00:00:44 v #276 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:42 d #61 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:it@4-194>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:44 v #277 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #278 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:42 v #62 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:42 v #63 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:42 v #64 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:44 v #279 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #280 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #281 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #282 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #283 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #284 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #285 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #286 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #287 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #288 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #289 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #290 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #291 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #292 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #293 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #294 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #295 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #296 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #297 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #298 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #299 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:42 v #65 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:44 v #300 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #301 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:40 v #219 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:40 v #220 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:42 v #66 > Server bound to: http://localhost:13805 00:00:40 v #221 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () = ()","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/20e725d46cfdc99c0f307f1933a76ec7da4570c1b757721164d86f19feaf821e/main.spi"}} / result: 00:00:40 v #222 Supervisor.sendJson / port: 13805 / json: {"FileTokenRange":{"range":[{"character":0,"line":0},{"character":16,"line":0}],"uri":"file:///home/...et/spiral_Eval/packages/20e725d46cfdc99c0f307f1933a76ec7da4570c1b757721164d86f19feaf821e/main.spi"}} / result: Some([ 0, 0, 3, 7, 0, 0, 4, 4, 0, 0, 0, 5, 1, 8, 0, 0, 1, 1, 8, 0, 0, 2, 1, 4, 0, 0, 2, 1, 8, 0, 0, 1, 1, 8, 0 ]) 00:00:40 v #223 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/20e725d46cfdc99c0f307f1933a76ec7da4570c1b757721164d86f19feaf821e"]}} / result: 00:00:45 v #302 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } Some [|0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; 8; 0; 0; 2; 1; 4; 0; 0; 2; 1; 8; 0; 0; 1; 1; 8; 0|]
In [ ]:
//// test
"""inl main () = 1i32"""
|> getCodeTokenRange None
|> Async.runWithTimeout 10000
|> Option.flatten
|> _assertEqual (Some [| 0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; 8; 0; 0; 2; 1; 4; 0; 0;
2; 1; 3; 0; 0; 1; 3; 12; 0 |])
00:00:46 v #303 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 d #67 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 ""/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64"; options = { command = dotnet "/home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release/Spiral.dll" --port 13805 --default-int i32 --default-float f64; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = Some <fun:it@4-426>; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot" } } 00:00:46 v #304 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #305 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #68 > 00:00:00 d #1 pwd: /home/runner/work/polyglot/polyglot 00:00:44 v #69 > 00:00:00 d #2 dllPath: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/The Spiral Language 2/artifacts/bin/The Spiral Language 2/release 00:00:44 v #70 > 00:00:00 d #3 targetDir: /home/runner/work/polyglot/polyglot/target/spiral_Eval 00:00:46 v #306 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #307 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #308 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #309 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #310 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #311 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #312 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #313 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #314 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #315 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #316 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #317 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #318 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #319 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:46 v #320 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #321 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #322 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #323 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #324 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:44 v #71 > Starting the Spiral Server. It is bound to: http://localhost:13805 00:00:47 v #325 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #326 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:47 v #327 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } 00:00:42 v #224 Supervisor.sendJson / port: 13805 / json: {"Ping":true} / result: 00:00:42 v #225 Supervisor.awaitCompiler / Ping / result: 'Some null' / port: 13805 / retry: 1 00:00:45 v #72 > Server bound to: http://localhost:13805 00:00:42 v #226 Supervisor.sendJson / port: 13805 / json: {"FileOpen":{"spiText":"inl main () = 1i32","uri":"file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/5370829508ddefc7386d6b4d280722b47d97cb925585525bee733a187ff8f18b/main.spi"}} / result: 00:00:43 v #227 Supervisor.sendJson / port: 13805 / json: {"FileTokenRange":{"range":[{"character":0,"line":0},{"character":18,"line":0}],"uri":"file:///home/...et/spiral_Eval/packages/5370829508ddefc7386d6b4d280722b47d97cb925585525bee733a187ff8f18b/main.spi"}} / result: Some([ 0, 0, 3, 7, 0, 0, 4, 4, 0, 0, 0, 5, 1, 8, 0, 0, 1, 1, 8, 0, 0, 2, 1, 4, 0, 0, 2, 1, 3, 0, 0, 1, 3, 12, 0 ]) 00:00:43 v #228 Supervisor.sendJson / port: 13805 / json: {"FileDelete":{"uris":["file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/5370829508ddefc7386d6b4d280722b47d97cb925585525bee733a187ff8f18b"]}} / result: 00:00:47 v #328 networking.test_port_open / { port = 13805; ex = System.AggregateException: One or more errors occurred. (Connection refused) } Some [|0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; 8; 0; 0; 2; 1; 4; 0; 0; 2; 1; 3; 0; 0; 1; 3; 12; 0|]
Arguments¶
In [ ]:
[<RequireQualifiedAccess>]
type Arguments =
| Build_File of string * string
| File_Token_Range of string * string
| Execute_Command of string
| [<Argu.ArguAttributes.Unique>] Timeout of int
| [<Argu.ArguAttributes.Unique>] Port of int
| [<Argu.ArguAttributes.Unique>] Parallel
| [<Argu.ArguAttributes.Unique>] Exit_On_Error
interface Argu.IArgParserTemplate with
member s.Usage =
match s with
| Build_File _ -> nameof Build_File
| File_Token_Range _ -> nameof File_Token_Range
| Execute_Command _ -> nameof Execute_Command
| Timeout _ -> nameof Timeout
| Port _ -> nameof Port
| Parallel -> nameof Parallel
| Exit_On_Error-> nameof Exit_On_Error
In [ ]:
//// test
Argu.ArgumentParser.Create<Arguments>().PrintUsage ()
"USAGE: dotnet-repl [--help] [--build-file <string> <string>] [--file-token-range <string> <string>] [--execute-command <string>] [--timeout <int>] [--port <int>] [--parallel] [--exit-on-error] OPTIONS: --build-file <string> <string> Build_File --file-token-range <string> <string> File_Token_Range --execute-command <string> Execute_Command --timeout <int> Timeout --port <int> Port --parallel Parallel --exit-on-error Exit_On_Error --help display this list of options. "
main¶
In [ ]:
let main args =
let argsMap = args |> Runtime.parseArgsMap<Arguments>
let buildFileActions =
argsMap
|> Map.tryFind (nameof Arguments.Build_File)
|> Option.defaultValue []
|> List.choose (function
| Arguments.Build_File (inputPath, outputPath) -> Some (inputPath, outputPath)
| _ -> None
)
let fileTokenRangeActions =
argsMap
|> Map.tryFind (nameof Arguments.File_Token_Range)
|> Option.defaultValue []
|> List.choose (function
| Arguments.File_Token_Range (inputPath, outputPath) -> Some (inputPath, outputPath)
| _ -> None
)
let executeCommandActions =
argsMap
|> Map.tryFind (nameof Arguments.Execute_Command)
|> Option.defaultValue []
|> List.choose (function
| Arguments.Execute_Command command -> Some command
| _ -> None
)
let timeout =
match argsMap |> Map.tryFind (nameof Arguments.Timeout) with
| Some [ Arguments.Timeout timeout ] -> timeout
| _ -> 60000 * 60
let port =
match argsMap |> Map.tryFind (nameof Arguments.Port) with
| Some [ Arguments.Port port ] -> Some port
| _ -> None
let isParallel = argsMap |> Map.containsKey (nameof Arguments.Parallel)
let isExitOnError = argsMap |> Map.containsKey (nameof Arguments.Exit_On_Error)
async {
let port =
port
|> Option.defaultWith getCompilerPort
let struct (localToken, disposable) = SpiralThreading.new_disposable_token None
let! serverPort, _errors, compilerToken, disposable = awaitCompiler port (Some localToken)
use _ = disposable
let buildFileAsync =
buildFileActions
|> List.map (fun (inputPath, outputPath) -> async {
let! _outputPath, (outputCode, errors) =
let backend =
if outputPath |> SpiralSm.ends_with ".fsx"
then Fsharp
elif outputPath |> SpiralSm.ends_with ".py"
then Cuda
else failwith $"Supervisor.main / invalid backend / outputPath: {outputPath}"
let isReal = inputPath |> SpiralSm.ends_with ".spir"
inputPath |> buildFile backend timeout (Some serverPort) None
errors
|> List.map snd
|> List.iter (fun error ->
trace Critical (fun () -> $"main / error: {error |> serializeObj}") _locals
)
match outputCode with
| Some outputCode ->
do! outputCode |> SpiralFileSystem.write_all_text_exists outputPath
return 0
| None ->
if isExitOnError
then SpiralRuntime.current_process_kill ()
return 1
})
let fileTokenRangeAsync =
fileTokenRangeActions
|> List.map (fun (inputPath, outputPath) -> async {
let! tokenRange = inputPath |> getFileTokenRange (Some serverPort) None
match tokenRange with
| Some tokenRange ->
do! tokenRange |> FSharp.Json.Json.serialize |> SpiralFileSystem.write_all_text_exists outputPath
return 0
| None ->
if isExitOnError
then SpiralRuntime.current_process_kill ()
return 1
})
let executeCommandAsync =
executeCommandActions
|> List.map (fun command -> async {
let! exitCode, result =
SpiralRuntime.execution_options (fun x ->
{ x with
l0 = command
l1 = Some compilerToken
}
)
|> SpiralRuntime.execute_with_options_async
trace Debug (fun () -> $"main / executeCommand / exitCode: {exitCode} / command: {command}") _locals
if isExitOnError && exitCode <> 0
then SpiralRuntime.current_process_kill ()
return exitCode
})
return!
[| buildFileAsync; fileTokenRangeAsync; executeCommandAsync |]
|> Seq.collect id
|> fun x ->
if isParallel
then Async.Parallel (x, float System.Environment.ProcessorCount * 0.51 |> ceil |> int)
else Async.Sequential x
|> Async.map Array.sum
}
|> Async.runWithTimeout timeout
|> Option.defaultValue 1
In [ ]:
//// test
let args =
System.Environment.GetEnvironmentVariable "ARGS"
|> SpiralRuntime.split_args
|> Result.toArray
|> Array.collect id
match args with
| [||] -> 0
| args -> if main args = 0 then 0 else failwith "main failed"
0