Wiki

Ticket #191 (new defect)

Opened 8 years ago

False compilation error with .getType on a generic type

Reported by: Chuck Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

The following code gives a false compilation error:

class Program

	def main
		.foo(String)
		.foo(String.getType)
		.foo(List<of int>)
		.foo(List<of int>.getType)  # false error
		
	def foo(t as Type?)
		pass

The error:

(10): error: For "foo" arg 1: The definition for "List<of>.getType" is not a type.

Cobra has some special treatment of .getType which is no doubt the source of the problem.

This is a low priority as passing the type directly (with no .getType) is the preferred coding style anyway. Cobra allows types to be passed directly, just like Python.

Note: See TracTickets for help on using tickets.