Skip to content

Change ClassicSolverFactory runtime libraries and :gui Application issue #499

@fmuratori

Description

@fmuratori

Platform:
This behaviour appears on a Kotlin/JS application.

How to reproduce the bug:
Here's the demo code for reproducing the bug:

// create a new SolverFactory with additional library IOLib
private val customSolverFactory: SolverFactory = ClassicSolverFactory
    .newBuilder()
    .withLibrary(IOLib) // open issue
    .toFactory()

// add new custom factory to :gui controller
var application: Application =
    TuPrologApplication.of(
        DefaultJsRunner(),
        customSolverFactory,
        Page.DEFAULT_TIMEOUT
    )

// create a new page (should use the custom factory)
application.newPage()

// handle page creation 
application.onPageCreated.bind { it:Event<Page> ->
  // problem here
  // page.solverBuilder doesn't have IOLib as a runtime library
}

Expected behaviour:
The solverBuilder of a newly created Page instance should also use IOLib as a runtime library

Workaround:
Add the library to the Page.solverBuilder instance as soon as the page is created

application.onPageCreated.bind { it:Event<Page> ->
  it.event.solverBuilder.withLibrary(IOLib)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions