Page MenuHomeFeedback Tracker

Improve support for template classes as attribute type
New, NormalPublic

Description

There are currently at least two bugs when trying to use template classes in attributes:
(1) They cannot be used directly as an attribute type
(2) When using a non-template base class as attribute type, typedef's of templated derived classes are not available in the list of classes that can be set

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce

(1a) Compile the script below:

//------------------------------------------------------------------------------------------------
[BaseContainerProps()]
class MyConfigEntryT<Class T> : Managed {}

//------------------------------------------------------------------------------------------------
[BaseContainerProps(configRoot: true)]
class MyConfig
{
	[Attribute()]
	ref MyConfigEntryT<int> m_pEntry;
}

(1b) Create a config of type MyConfig
(1c) Open the config, instantiate Entry, by clicking on set class, then save and close it.
(1d) Trying to open the config again will throw the message below and the class for Entry is unset.

RESOURCES    : LoadGenericConfig @"{AD2A0EE4B7FFC33C}Configs/Systems/MyConfig.conf"
 RESOURCES (E): Unknown class 'MyConfigEntryT' at offset 61(0x3d)
 DEFAULT   (E): Can't load 'Configs/Systems/MyConfig.conf' because class 'MyConfigEntryT' is unknown

(2a) Compile the script below:

//------------------------------------------------------------------------------------------------
[BaseContainerProps()]
class MyBaseConfigEntry {} // Available

//------------------------------------------------------------------------------------------------
[BaseContainerProps()]
class MyDerivedConfigEntry : MyBaseConfigEntry {} // Available

//------------------------------------------------------------------------------------------------
[BaseContainerProps()]
class MyDerivedConfigEntryT<Class T> : MyBaseConfigEntry {}

//------------------------------------------------------------------------------------------------
typedef MyDerivedConfigEntryT<int> TIntMyDerivedConfigEntry; // Unavailable

//------------------------------------------------------------------------------------------------
[BaseContainerProps()]
class MyDerivedConfigEntryInt : MyDerivedConfigEntryT<int> {} // Unavailable

//------------------------------------------------------------------------------------------------
[BaseContainerProps(configRoot: true)]
class MyConfig
{
	[Attribute()]
	ref MyBaseConfigEntry m_pEntry;
}

(2b) Open the config and try to instantiate Entry, by clicking on set class
(2c) Notice that both MyDerivedConfigEntryInt and MyDerivedConfigEntryT<int> are not available for selection

Event Timeline

ookexoo created this task.Fri, Jul 4, 9:32 PM
ookexoo edited Steps To Reproduce. (Show Details)Fri, Jul 4, 9:34 PM
ookexoo updated the task description. (Show Details)Fri, Jul 4, 9:39 PM