Wiki

Ticket #76 (closed defect: fixed)

Opened 16 years ago

Last modified 15 years ago

to? should give warnings if the operation is redundant

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

Description

The expression a to? B is a no-op when a is already of type B or B?. There are already warnings for a to B when that is redundant, so this is missing for to?.

Should get two warnings below; currently get none.

class A

	def main is shared
		a = A()
		b = a to? A  # .warning.
		c = a to ?
		d = c to? A  # .warning.
		CobraCore.noOp(a, b, c, d)

Attachments

typecast-to-nil-warnings.patch Download (3.6 KB) - added by hopscc 15 years ago.

Change History

Changed 15 years ago by hopscc

Changed 15 years ago by hopscc

  • owner set to chuck
  • status changed from new to assigned

patch, add test file, relnotes.

Changed 15 years ago by Chuck

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

Nice patch. Thanks.

changeset:2211

Note: See TracTickets for help on using tickets.