Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that some obvious problems give errors
- Loading branch information
Showing
22 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateType.pth: 8:1-15: Duplicate type name: a type named 'Test' already exists in this compilation unit | ||
|
||
class Test | ||
{ | ||
} | ||
|
||
interface Test | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateField.pth: 7:3-9: A field with the name 'x' already exists in 'Foo', so another field cannot be defined with the same name | ||
|
||
class Foo | ||
{ | ||
uint x; | ||
Foo x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateFieldProperty.pth: 7:3-20: A field with the name 'x' already exists in 'Foo', so a property cannot be defined with the same name | ||
|
||
class Foo | ||
{ | ||
uint x; | ||
property ulong x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateProperty.pth: 7:3-19: A property with the name 'x' already exists in 'Foo', so another property cannot be defined with the same name | ||
|
||
class Foo | ||
{ | ||
property uint x; | ||
property long x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicatePropertyField.pth: 7:3-10: A property with the name 'x' already exists in 'Foo', so a field cannot be defined with the same name | ||
|
||
class Foo | ||
{ | ||
property ulong x; | ||
uint x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateTypeParameter.pth: 4:14: Duplicate type parameter: T | ||
|
||
class Foo<T, T> | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateField.pth: 7:3-9: A field with the name 'x' already exists in 'Foo', so another field cannot be defined with the same name | ||
|
||
compound Foo | ||
{ | ||
uint x; | ||
Foo x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateFieldProperty.pth: 7:3-20: A field with the name 'x' already exists in 'Foo', so a property cannot be defined with the same name | ||
|
||
compound Foo | ||
{ | ||
uint x; | ||
property ulong x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateProperty.pth: 7:3-19: A property with the name 'x' already exists in 'Foo', so another property cannot be defined with the same name | ||
|
||
compound Foo | ||
{ | ||
property uint x; | ||
property long x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicatePropertyField.pth: 7:3-10: A property with the name 'x' already exists in 'Foo', so a field cannot be defined with the same name | ||
|
||
compound Foo | ||
{ | ||
property ulong x; | ||
uint x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateTypeParameter.pth: 4:17: Duplicate type parameter: T | ||
|
||
compound Foo<T, T> | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Plinth Test | ||
// Compiler: Constructor.pth: 6:3-11: Interfaces cannot have constructors | ||
|
||
interface Test | ||
{ | ||
create() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateField.pth: 7:3-16: A field with the name 'x' already exists in 'Foo', so another field cannot be defined with the same name | ||
|
||
interface Foo | ||
{ | ||
static uint x; | ||
static Foo x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateFieldProperty.pth: 7:3-27: A field with the name 'x' already exists in 'Foo', so a property cannot be defined with the same name | ||
|
||
interface Foo | ||
{ | ||
static uint x; | ||
static property ulong x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateProperty.pth: 7:3-19: A property with the name 'x' already exists in 'Foo', so another property cannot be defined with the same name | ||
|
||
interface Foo | ||
{ | ||
property uint x; | ||
property long x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Plinth Test | ||
// Compiler: DuplicatePropertyField.pth: 7:3-17: A property with the name 'x' already exists in 'Foo', so a field cannot be defined with the same name | ||
|
||
interface Foo | ||
{ | ||
static property ulong x; | ||
static uint x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Plinth Test | ||
// Compiler: DuplicateTypeParameter.pth: 4:18: Duplicate type parameter: T | ||
|
||
interface Foo<T, T> | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Plinth Test | ||
// Compiler: NativeUpcall.pth: 6:3-36: Non-static methods on generic interfaces cannot be native up-calls | ||
|
||
interface Test<T> | ||
{ | ||
native "test" void nativeUpcall() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Plinth Test | ||
// Compiler: NonStaticBackedProperty.pth: 6:3-18: Interfaces cannot store (non-static) data - should this property be unbacked? | ||
|
||
interface Test | ||
{ | ||
property uint x | ||
getter | ||
{ | ||
return x; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Plinth Test | ||
// Compiler: NonStaticField.pth: 6:3-10: Interfaces cannot store (non-static) data | ||
|
||
interface Foo | ||
{ | ||
uint x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Plinth Test | ||
// Compiler: NonStaticInitialiser.pth: 6:3: Interfaces cannot contain non-static initialisers | ||
|
||
interface Foo | ||
{ | ||
{ | ||
// this is an initialiser | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Plinth Test | ||
// Compiler: Property.pth: 7:17-22: A property method cannot throw checked exceptions. Consider marking them as unchecked. | ||
|
||
class Test | ||
{ | ||
property uint foo | ||
getter throws Alpha | ||
{ | ||
}; | ||
} |