Revision b915ae662b2e4bcaaeb6da62eb964356d0a978b4 authored by jsmall-nvidia on 05 May 2022, 19:53:29 UTC, committed by GitHub on 05 May 2022, 19:53:29 UTC
* #include an absolute path didn't work - because paths were taken to always be relative.

* Add support for HLSL `export`.

* Test for using `export` keyword.
1 parent 3088d90
Raw File
variable-redeclaration.slang
// variable-redeclaration.slang

//DIAGNOSTIC_TEST:SIMPLE:


// This test confirms that the compiler produces
// suitable diagnostics when variables are redeclared
// in a given scope.

// Global variables, including shader parameters

static int gA;

static Texture2D gA;

// Local variables

int testLocalRedeclaration(int x)
{
	int y = x;
	int y = x;
}

int testLocalShadowing(int x)
{
	int y = x;
	{
		// Because this declaration is in an inner
		// scope it should shadow the existing `y`
		// rather than conflcit with it.
		//
		// TODO: It would be reasonable for the
		// compiler to warn on this sort of code.
		//
		int y = x;
	}
}

// Structure fields

struct S
{
	int f;
	float f;
}

// Function parameter list

int testParameterRedeclaration(
	int 	size,
	float 	size)
{
	return size;
}
back to top