Wiki

Ticket #214 (new defect)

Opened 14 years ago

Last modified 12 years ago

Members use in preconditions on x mustn't be less visible than x.

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

Description

My lame example covers just one case. lame is less visible than meth, and so should fail to compile.

{{{class A

var lame as int is private

cue init

base.init
lame = #[something secretly computed inside A]

def meth

require

lame == 1

body

print "hello"

class P

def main

a = A()
a.meth}}}

Change History

Changed 14 years ago by nevdelap

Damn. I meant to click Preview and now the lame somehow came out as underlines, and the I guess have to be on their own lines? Oh well.

Changed 12 years ago by Charles

This goes for post conditions as well.

Also, invariants shouldn't reference protected or private members.

Since we currently allow all of this, start with warnings. Make errors later.

Note: See TracTickets for help on using tickets.