Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid GetGenericParamInstance with extension #2118

Closed
disarray2077 opened this issue Jan 30, 2025 · 3 comments
Closed

Invalid GetGenericParamInstance with extension #2118

disarray2077 opened this issue Jan 30, 2025 · 3 comments

Comments

@disarray2077
Copy link
Contributor

This is another crash I found in the LuaTinker project.

To reproduce:

  1. Open the file "LuaTinker/Wrappers/Pointer/ClassInstanceWrapper.bf"
  2. Add the following line at the top:
    using LuaTinker.StackHelpers;
  3. At the end of the file, inside the extension ClassInstanceWrapper<T>, add:
    public void Test(LuaTinker lua)  
    {  
        StackHelper.Pop!<int>(lua, 0);  
    }  
  4. The IDE should crash with the following error:
---------------------------
FATAL ERROR
---------------------------
FATAL MODULE ERROR
Invalid GetGenericParamInstance with extension at C:\Jenkins\workspace\Beef\IDEHelper\Compiler\BfModuleTypeUtils.cpp:9643
Module: 
Type: LuaTinker.Wrappers.ClassInstanceWrapper<T>
Method: LuaTinker.Wrappers.ClassInstanceWrapper<T>.Test(LuaTinker.LuaTinker lua)

Tested with: 439ae8d

@kallisto56
Copy link
Contributor

Trimmed version: bug.2118trimmed3.zip
In order to trigger a crash, uncomment code inside ClassInstanceWrapper<T>.
Note: crash only happens when mixins are defined in extension and when ClassInstanceWrapper<T> has at least empty extension.

@kallisto56
Copy link
Contributor

Boiled it down even further:

namespace bug2118trimmed4;

using System;

// Uncomment this to trigger a crash
//extension Foo<T> {}

class Foo<T> where T : class
{
	static void Test ()
	{
		Helper.Pop!<int>();
	}
}


class Helper {}
extension Helper
{
	static public mixin Pop<T> ()
	{
		Pop<int>()
	}

	static public T Pop<T> () where T : var, struct, INumeric
	{
		return default;
	}
}

@bfiete
Copy link
Collaborator

bfiete commented Jan 31, 2025

Fixed at 2f7616c

@bfiete bfiete closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants