Wiki

Ticket #60 (closed defect: fixed)

Opened 16 years ago

Last modified 16 years ago

Method overrides can narrow a type from nilable to not-nilable

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

Description

...but they should not be able to. This must be an error:

	def equals(other as Object) as bool is override
# must be:
	def equals(other as Object?) as bool is override

Change History

Changed 16 years ago by Chuck

  • milestone set to Cobra 0.9

The test case for methods should be something other than .equals as that is about to become a cue. Here's a proper test case:

class A

	def foo(s as String?)
		pass


class B
	inherits A
	
	def foo(s as String) is override  # .error. cannot narrow
		pass


class P

	def main is shared
		pass

Changed 16 years ago by Chuck

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:1832

Note: See TracTickets for help on using tickets.