Skip to content

ExprSpread loses type information on types that don't exist #153

@Fusezion

Description

@Fusezion

Describe the bug
When using the spread expression javaobjects fail to retain their supertype of javaobject and convert to only objects and can no longer be returned in functions with the type of 'javaobjects'

To reproduce

import:
    io.papermc.paper.ban.BanListType
    org.bukkit.Bukkit

on load:
    wait 3 seconds
    broadcast "Bans? %Bukkit.getBanList(BanListType.PROFILE).getBanEntries()%"
    send "lazyTestJavaObject", lazyTestJavaObject()
    send "lazyTestObject", lazyTestObject()
function lazyTestJavaObject() :: javaobjects:
    return ...Bukkit.getBanList(BanListType.PROFILE).getBanEntries()
function lazyTestObject() :: objects:
    return ...Bukkit.getBanList(BanListType.PROFILE).getBanEntries()

Expected behavior
skript-reflect to properly retain the type of the provided object when the conversion to a skript list/object occurs

Screenshots

Image

Server information

[12:15:28 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[12:15:28 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[12:15:28 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[12:15:28 INFO]: [Skript] Server Version: 1.21.8-60-29c8822 (MC: 1.21.8)
[12:15:28 INFO]: [Skript] Skript Version: 2.13.1 (skriptlang-github)
[12:15:28 INFO]: [Skript] Installed Skript Addons:
[12:15:28 INFO]: [Skript]  - skript-yaml v1.7.2
[12:15:28 INFO]: [Skript]  - DiSky v4.26.0
[12:15:28 INFO]: [Skript]  - SkBriggy v1.5.4 (https://github.com/ShaneBeee/SkBriggy)
[12:15:28 INFO]: [Skript]  - oopsk v1.0-beta1 (https://github.com/sovdeeth/oopsk)
[12:15:28 INFO]: [Skript]  - skript-gui v1.3.2 (https://github.com/APickledWalrus/skript-gui)
[12:15:28 INFO]: [Skript]  - skript-reflect v2.6.1 (https://github.com/SkriptLang/skript-reflect)
[12:15:28 INFO]: [Skript]  - skript-particle v1.3.2 (https://github.com/sovdeeth/skript-particle)
[12:15:28 INFO]: [Skript]  - skript-placeholders v1.7.0 (https://github.com/APickledWalrus/skript-placeholders)
[12:15:28 INFO]: [Skript]  - SkBee v3.13.1 (https://github.com/ShaneBeee/SkBee)
[12:15:28 INFO]: [Skript] Installed dependencies:
[12:15:28 INFO]: [Skript]  - Vault v2.4.9
[12:15:28 INFO]: [Skript]  - WorldGuard v7.0.14+2339-43997ec

Additional context
After writing out my issue initially I believe the core issue lies in the ExprSpread and how it handles conversions, tho it looks like internally it meant to retain types correctly.

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