Ticket #256 (new defect)
This code not implementing all interfaces' methods compiles a broken assembly.
Reported by: | nevdelap | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
This code is incorrect because it doesn't implement IEnumerable<of T>.getEnumerator but it compiles.
use System.Collections use System.Collections.Generic namespace Test class ReadOnlyList<of T> implements IEnumerable, IEnumerable<of T> var _list as IList<of T> cue init(list as IList<of T>) test ints = ReadOnlyList<of int>(List<of int>(@[1, 2, 3, 4])) assert ints.count == 4 assert ints.contains(1) assert ints.indexOf(3) == 2 assert ints[2] == 3 assert ints.isReadOnly total = 0 for i in ints total += i assert total == 10 body base.init _list = list get count as int return _list.count def contains(item as T) as bool return _list.contains(item) def indexOf(item as T) as int return _list.indexOf(item) get [index as int] as T return _list[index] get isReadOnly as bool return true def getEnumerator as IEnumerator? return _list.getEnumerator
Change History
Note: See
TracTickets for help on using
tickets.