Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wurstscript/WurstScript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: wurstscript/WurstScript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: lua-closure-instanceof-identity
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 6 commits
  • 9 files changed
  • 1 contributor

Commits on Oct 21, 2026

  1. Lua: tell the instantiations apart in an instanceof written in a closure

    An instanceof Box<T> in a closure written in a method of a generic class
    accepted every Box on Lua. #1507 kept closures erased for an instanceof,
    because specialising one left its captured receiver typed by the erased
    class; #1512 fixed that receiver, so the exclusion is lifted: an instanceof
    of the type parameter now counts towards a closure's identity like any
    other member which needs its type argument.
    
    A closure which constructs the Box<T> another closure checks still stayed
    erased. Box<int> is observed only once the checking closure is
    specialised, in the second round, but classNeedsIdentity keeps its first
    answer, given in the first. Whether an instanceof observes a class is now
    collected once, before the specialisation, from every parameterised
    instanceof, including one still written with a type variable.
    
    The IM interpreter compared only the class in an instanceof, so it took a
    Box<string> for a Box<int> in compile-time code and @test functions. It
    now compares the type arguments of the instantiation too. The audit tests
    for instanceof identity run the interpreter on the generic program again.
    
    Removes the nine INSTANCEOF_CLOSURE cases from the matrix's known failures
    and the lua-instanceof-erased backlog entry. Records a crash found on the
    way: a closure inside another closure which uses its owner's T fails in
    EliminateGenerics on Jass and Lua.
    Frotty committed Oct 21, 2026
    Configuration menu
    Copy the full SHA
    3fd442a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7588a11 View commit details
    Browse the repository at this point in the history
  3. Compare instantiations in the interpreter's instanceof as the special…

    …isation does
    
    Type-class bindings are dispatch metadata, which GenericTypes ignores at every
    nesting level when it tells specialisations apart; the interpreter now compares
    an object's instantiation with the checked one the same way, instead of through
    equalsType, which compares nested bindings. Adds a check of a type argument with
    a bound inside it, built directly and through generic functions.
    Frotty committed Oct 21, 2026
    Configuration menu
    Copy the full SHA
    3e5f579 View commit details
    Browse the repository at this point in the history
  4. Check every path to a generic supertype in the interpreter's instanceof

    A class which reaches one generic interface through two others, as G<int> and
    as G<string>, is an instance of both, as on Jass and Lua. The interpreter
    compared the checked instantiation with the first path to the interface only,
    so one of the two checks was false. It now collects the instantiations of
    every path.
    Frotty committed Oct 21, 2026
    Configuration menu
    Copy the full SHA
    4eb1129 View commit details
    Browse the repository at this point in the history
  5. Merge remote-tracking branch 'origin/master' into lua-closure-instanc…

    …eof-identity
    
    # Conflicts:
    #	BACKLOG.md
    Frotty committed Oct 21, 2026
    Configuration menu
    Copy the full SHA
    f0f6c07 View commit details
    Browse the repository at this point in the history
  6. Give a closure written inside another closure its owner's type parame…

    …ters (#1516)
    
    * Give a closure written inside another closure its owner's type parameters
    
    A closure written in another closure, in a generic class or function, made
    EliminateGenerics throw "Rewrite generics with wrong sizes" on Jass and Lua
    whenever either closure used the owner's T, even for a plain field read.
    The inner closure is translated while the enclosing closure's class is
    being created, before that class has its captured type variables: the
    inner closure captured the enclosing this as a class type without type
    arguments, and the enclosing closure allocated the inner one without them.
    
    ClosureTranslator now leaves the type variables of a closure written in
    another one to the outermost closure, which captures the same variables,
    all that any closure of the nest uses and in the same order, for each class
    of the nest, and makes each class name the others with its own variables.
    A closure with no closure inside it captures what it captured before.
    
    With that, EliminateGenerics no longer leaves such closures out of
    classNeedsIdentity (isInsideAnotherClosure), so on Lua an instanceof
    Box<T> in an inner closure tells the instantiations apart too.
    
    * Turn the test of a rejected nested closure into a success case
    
    TypeClassTests pinned that a closure written inside another one in a bounded
    generic function was rejected on Lua ("could not be resolved for the Lua
    target"), and asked to become a success case once that works. It works now:
    the program dispatches on the bound on Jass, the interpreter and Lua.
    Frotty authored Oct 21, 2026
    Configuration menu
    Copy the full SHA
    359a92c View commit details
    Browse the repository at this point in the history
Loading