__color__ ticket summary component version milestone type owner status created updated _description _reporter 2 378 CIE by incomplete `StreamType` construction. Cobra Compiler 0.9.6 defect new 2014-08-02T09:28:05Z 2014-08-02 09:57:33 "Cobra svn:3116 throws this CIE {{{ error: COBRA INTERNAL ERROR / NullReferenceException / Object reference not set to an instance of an object. }}} when compiling this program: {{{ class Program shared def m as T* return T[](0) def main x = .m CobraCore.noOp(x) }}} " thriwkin 2 379 enum of int8/uint8: translation wrong Cobra Compiler 0.9.6 defect new 2014-08-05T03:19:57Z 2014-08-07 11:20:24 "If an `enum` is declared with an underlying type of `int8` or `uint8` then the translation to C# is incorrect: * `int8` is translated to `byte` instead of `sbyte`[[BR]] -- without any message! * `uint8` is translated to `ubyte` instead of `byte`,[[BR]] and the C# compiler gives this message: [[BR]] ""error: CS1008: Type byte, sbyte, short, ushort, int, uint, long, or ulong expected"". This program should compile and run: {{{ enum EnumOfInt8 of int8 A, B, C enum EnumOfUInt8 of uint8 A, B, C class Program def main is shared t = Enum.getUnderlyingType(EnumOfInt8.getType) print t assert t is int8 assert t is System.SByte t = Enum.getUnderlyingType(EnumOfUInt8.getType) print t assert t is uint8 assert t is System.Byte }}} That `of int8` is '''quietly''' translated incorrectly can cause a lot of trouble, especially in a large program. " thriwkin 2 380 "CIE caused by local var declaration ""x as EnumType""." Cobra Compiler 0.9.6 defect new 2014-08-05T04:28:56Z 2014-08-05 04:52:05 " Compiling this with Cobra svn:3116 {{{ class Program def main is shared x as PlatformID CobraCore.noOp(x) }}} causes this CIE: {{{ error: COBRA INTERNAL ERROR / ArgumentOutOfRangeException / Index was out of range. Must be non-negative and less than the size of the collection.; Parameter name: index }}} The critical code pattern is: {{{ def m x as T ... }}} where `T` references an enum which is defined in another assembly, for example `PlatformID, StringComparison, StringSplitOptions, ...` . " thriwkin 3 321 Overload resolution needs improvement Cobra Compiler 0.9.3 defect new 2013-05-14T00:09:30Z 2013-05-27 10:51:40 "Cobra's method overload resolution skips certain method names with the following `if` guard in _bindImp of CallExpr: {{{ if winner.name not in ['format', 'invoke', 'split', 'sort'] }}} That indicates that 3rd party libraries are going to have problems which currently have no workaround (other than using a `sharp` string). Note that since Cobra uses C# as a back-end, it will largely need to match C#'s overload resolution with the exception that since extension methods can be called explicitly as static/shared methods, Cobra may bind to those in cases where C# would not. See also: ticket:189 " Charles 3 342 Cannot declare method overloads in mixins Cobra Compiler 0.9.4 defect new 2013-07-18T21:42:02Z 2013-07-20 16:51:01 "The following code produces the error message: 'mixin added method ""foo"" is already in class ""Testing""' {{{ mixin Behavior def foo(i as int) pass def foo pass class Testing adds Behavior pass }}} " nerdzero 3 346 Cannot break out of a loop from within a branch Cobra Compiler 0.9.4 defect new 2013-10-03T17:56:44Z 2013-10-03 17:56:44 "The generated C# treats the 'break' statement as being part of the switch structure instead of breaking out of the loop. Test case that results in infinite loop. {{{ class Program def main x = 1 while true branch x on 1 trace x break else print ""Should not get printed"" print ""done"" }}} One solution is to generate a goto statement in the C#. Some more alternatives are here: http://stackoverflow.com/questions/1987379/break-out-of-a-loop-that-contains-a-switch-statement-c" nerdzero 3 356 Preconditions for methods that return a stream are not checked Cobra Compiler 0.9.6 defect new 2014-01-21T23:49:00Z 2014-01-21 23:49:00 "This program fails, but should succeed. The contract for .bar is never checked/executed at run-time: {{{ #!cobra class P var _last = '' def main .foo assert _last == 'foo' .bar for b in .bar, print b assert _last == 'bar' def foo as int require .required('foo') body return 0 def bar as int* require .required('bar') body yield 1 def required(name as String) as bool _last = name return true }}} " Charles 3 361 Getters should always specify return types Cobra Compiler 0.9.6 defect new 2014-02-01T06:20:41Z 2014-02-04 10:46:36 "currently cobra accepts code such as this: {{{ get hasSubCmds return _sub.count > 0 }}} however it seems to get confused about the type, in the call site. I suggest making it mandatory to supply a return value, (which the user may simply forget sometimes). {{{ get hasSubCmds as bool return _sub.count > 0 }}} " kobi7 3 373 block comments extends to last commented line Cobra Compiler 0.9.6 defect new 2014-07-14T10:11:18Z 2014-07-14 10:11:18 "The entire line following the closing tag for a block comment #/ is deactivated as well. Compilation of... {{{ class DebugCase def main is shared /# i as int for i in -13:57:7 print i i as int #/ i=-13 while i<57 print i i += 7 }}} ...fails with {{{ # cobra.bat -version Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1 # -c CobraDebug01.cobra CobraDebug01.cobra(10): error: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". CobraDebug01.cobra(11): error: For ""print"" arg 1: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". CobraDebug01.cobra(12): error: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". }}} You can create all sorts of compiler- or runtime errors this way. For instance the following... {{{ class DebugCase def main is shared i = -27 /# i as int for i in -13:57:7 print i i as int #/ i=-13 while i<57 print i i += 7 }}} ... produces the output {{{ -27 -20 -13 -6 1 8 15 22 29 36 43 50 }}} It is possible to work around this by putting the closing tag at the end of the last line to comment OR insert a line break after it." ptokremin 3 374 shared classes do not compile Cobra Compiler 0.9.6 defect new 2014-07-15T11:47:53Z 2014-07-17 09:36:59 "It is not possible to declare shared (static) classes. The following definition... {{{ namespace CobraDebug03 class LibTools is public, shared def doIt as String is public, shared return ""great, it work's! :-)"" }}} ... produces error messages from the c# compiler (since they are in german on my system I translated them): {{{ # cobra.bat -version Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1 #cobra.bat -c CobraDebug03.cobra d:\tmp\nh\CobraDebug03.cobra(5): error: ""CobraDebug03.LibTools._ih_invariantGuard"": instance members may not be declared in a static class d:\tmp\nh\CobraDebug03.cobra(5): error: static classes may not have an instance constructor Compilation failed - 2 errors, 0 warnings }}} The messages refer to the property _ih_invariantGuard and the constructor for the c#-class. Here's the intermediate code (without the #line tags) generated by cobra: {{{ using CobraCoreInternal = Cobra.Core; namespace CobraDebug03 { public static class LibTools : global::System.Object { int _ih_invariantGuard; [CobraCoreInternal.NotNull] public static global::System.String DoIt() { return ""greaaaat :-)""; } public LibTools() : base() { } } // class LibTools } // namespace CobraDebug03 }}} A rather ugly work-around is NOT to declare the class as shared. " ptokremin 3 370 Some MD/XS projects trigger a COBRA INTERNAL ERROR/FormatException Cobra Compiler 0.9.6 Cobra 0.9 defect new 2014-06-11T18:46:45Z 2014-06-30 14:59:00 "On Mac OSX 10.8.5 , with Cobra 0.9.6, using Mono 3.4.0 I get the following Internal Error /Library/Frameworks/Mono.framework/External/xbuild/Cobra/Cobra.targets: error : error: COBRA INTERNAL ERROR / FormatException / Input string was not in the correct format Task ""CobraCompiler"" execution -- FAILED Done building target ""CoreCompile"" in project ""/Users/klickle/Downloads/CherryCobbler/CherryCobbler/CherryCobbler.cobraproj"".-- FAILED I have recently added a file (in progress of making a port of some python code), and the behavior did not manifest until I started on this file." torial 4 171 Dynamic does not work well with arithmetic Cobra Compiler 0.8.0 defect new 2009-07-19T19:09:17Z 2009-07-19 19:09:17 "Dynamic works well with method calls. For example, given a local `d` of type `dynamic`, you can say `.foo(d)` even if .foo is expecting a static type. And you can say `x = d.bar(args)` where .bar is late bound. However, `x + d` and `d + x` yield compilation errors. They should work and be late bound. Same with all other operators. (Unfortunately, .NET does not make this easy as operators are static methods sitting around in various classes.) " Chuck 4 187 Short circuit evaluation for chained comparisons Cobra Compiler 0.8.0 defect new 2009-11-03T06:26:37Z 2009-11-03 06:33:13 "Like other boolean expressions, chained comparisons should short circuit. That means that subsequent expressions are not even evaluated if not needed. There is a test case commented out in Tests/320-misc-two/260-chained-comparison.cobra The original work was on ticket:161 and changeset:2229 " Chuck 4 188 Chained comparisons should be implemented with strong types when possible Cobra Compiler 0.8.0 defect new 2009-11-03T06:31:50Z 2009-11-03 06:31:50 "The implementation of chained comparisons uses the `dynamic` type even when an expression such as `0 <= i < 9` where `i` is type `int` could run at ""full native speed"" using all ints. For example, it should be possible to show that the above expression is substantially slower than ""0 <= i and i < 9"". See also: ticket:187 " Chuck 4 214 Members use in preconditions on x mustn't be less visible than x. Cobra Compiler 0.8.0 defect new 2010-07-12T01:49:24Z 2012-10-31 21:20:29 "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}}}" nevdelap 4 228 Cobra Internal Error with IronPython (mscorlib) Cobra Compiler 0.8.0 defect new 2010-07-31T04:35:53Z 2010-07-31 04:35:53 "With IronPython 2.7, and the @ref'd DLLs copied from IronPython/Silverlight/bin into my bin directory, I get the following error: me@LAPBOT ~/code/sherlock/bin (master) $ cat test.cobra @ref ""IronPython.dll"" @ref ""Microsoft.Dynamic.dll"" @ref ""Microsoft.Scripting.dll"" @ref ""IronPython.Modules.dll"" use IronPython class Poo def main pass me@LAPBOT ~/code/sherlock/bin (master) $ cobra test.cobra error: COBRA INTERNAL ERROR / TypeLoadException / Could not load type 'System.Co llections.IStructuralEquatable' from assembly 'mscorlib, Version=2.0.0.0, Cultur e=neutral, PublicKeyToken=b77a5c561934e089'. Compilation failed - 1 error, 0 warnings Not running due to errors above. If I downgrade to IronPython 2.6.1, instead I get: error: COBRA INTERNAL ERROR / BadImageFormatException / Could not load file or a ssembly 'file:///c:\Users\me\code\sherlock\bin\IronPython.dll' or one of its dep endencies. This assembly is built by a runtime newer than the currently loaded r untime and cannot be loaded. I'm using Cobra from SVN." Kurper 4 291 lambda and object initialization compiler error Cobra Compiler 0.8.0 defect new 2012-08-05T16:32:22Z 2012-08-17 16:23:29 "This example comes from DefaultDictionary.cobra This compiles {{{ factory as Func = do = 5 dd = DefaultDictionary(factory, willRecordDefaults = false) }}} This doesn't {{{ dd = DefaultDictionary(do = 5, willRecordDefaults = false) }}} {{{ DefaultDictionary.cobra(112): error: Cannot convert ""anonymous method"" to non-delegate type ""object"" DefaultDictionary.cobra(112): error: The best overloaded method match for ""Cobra.CoreX.TestDefaultDictionary._ch_ext_init_6222(object, bool)"" has some invalid arguments DefaultDictionary.cobra(112): error: Argument ""#1"" cannot convert ""anonymous method"" expression to type ""object"" DefaultDictionary.cobra(58): error: The best overloaded method match for ""Cobra.CoreX.DefaultDictionary.DefaultDictionary(System.Func)"" has some invalid arguments }}} Cobra svn:2771 (post 0.8) / 2012-08-05 on Mono 2.10.9 CLR v4.0.30319 on Mac OS X 10.6.8 " jaegs 4 348 Installer leaves root owned files Cobra Compiler 0.9.4 defect new 2013-12-22T21:06:33Z 2013-12-22 21:06:33 "The installer requires sudo on UnixLike system and one side effect of this is the remainder of files that cannot be manipulated when not root: {{{ Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug/HelloWorld.exe: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug/HelloWorld.exe.mdb: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.cobraproj.FilesWrittenAbsolute.txt: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.exe: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.exe.mdb: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj: Operation not permitted Source/hello.cobra: Operation not permitted Source/InstallFromWorkspace.exe.mdb: Operation not permitted Source/Misc/hello.exe.mdb: Operation not permitted }}} To fix this, possibilities include: * Modify the owner or perms afterwards * Run the commands that create these files in such a way that this doesn't happen in the first place Btw, the current workaround is to issue this command from within the workspace {{{ sudo chown -R MYUSERNAME . }}}" Charles 4 357 Internal error for parameter named `result` Cobra Compiler 0.9.6 defect new 2014-01-27T02:29:20Z 2014-01-27 02:29:20 "The following code gives an internal error: {{{ #!cobra class A def foo(result as int) as String return '' }}} The error goes away if `result` is named to something else, or if the return type and return statement are removed (add `pass`). Whether the method is `shared` or not makes no difference." Charles 4 364 Cobra snapshot may have been compiled on .NET 4.5 and inadvertently introduced a dependency Cobra Compiler 0.9.6 defect new 2014-02-11T20:02:44Z 2014-02-14 17:12:55 "I was installing Cobra on a new box for testing some older patches. The OS is Ubuntu 12.04 LTS. I installed the prerequisites: {{{ sudo apt-get install mono-runtime mono-dmcs mono-xbuild }}} This installed Mono 2.10.8.1 I downloaded the latest source from subversion: {{{ svn co http://cobra-language.com/svn/cobra/trunk/ cobra }}} I executed the installer: {{{ cd cobra/Source sudo bin/install-from-workspace }}} I got this exception: {{{ Compiling installation program... Missing method System.Environment::get_CurrentManagedThreadId() in assembly /usr/lib/mono/4.0/mscorlib.dll, referenced in assembly /home/ramon/cobra/Source/Snapshot/cobra.exe Unhandled Exception: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'. at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in :0 at Compiler._compile1 (.CompileParams params) [0x00000] in :0 at Compiler.Compile (.CompileParams params) [0x00000] in :0 at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in :0 at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in :0 at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in :0 at CommandLine.Run () [0x00000] in :0 at CobraMain.Main () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'. at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in :0 at Compiler._compile1 (.CompileParams params) [0x00000] in :0 at Compiler.Compile (.CompileParams params) [0x00000] in :0 at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in :0 at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in :0 at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in :0 at CommandLine.Run () [0x00000] in :0 at CobraMain.Main () [0x00000] in :0 }}} I googled the exception and got this hit: http://marcgravell.blogspot.de/2012/09/iterator-blocks-missing-methods-and-net.html I haven't had the chance to test on .NET 4.0. Need to find a system that doesn't have 4.5" nerdzero 4 368 Dynamic variables that are Arrays should support Indexing Cobra Compiler 0.9.6 defect new 2014-04-24T11:50:50Z 2014-04-24 11:54:35 "If variables or fields are declared as dynamic and typed as Arrays they should support Indexors (read only at least) given how many of the .Net framework APIS return arrays rather than lists/collections. Currently indexing such a variable emits a 'Cobra.Core.UnknownMemberException' from the RTL call to Cobra.Core.CobraImp.getIndexerValue since it only looks for Object/Collection Indexors and not ones on arrays. See [http://cobra-language.com/forums/viewtopic.php?f=4&t=17287 UnknownMemberException thrown on local variable assignment] for a very good example " hopscc 4 369 Assigning values to enums out-of-order does not work Cobra Compiler 0.9.6 defect new 2014-05-02T12:04:46Z 2014-05-05 11:32:52 "This may be an abuse of enums, but I am setting up some default values in my app through the use of enums, and I noticed that assigning them values directly does not work if they are not in numerical order. I do not receive a warning or error during compilation. e.g., class Test ..enum Defaults ....HalfAMillion = 500000, ....Zero = 0 ..def main ....print Defaults.Zero to int #actually prints 500001 " NoshBar 4 376 Cannot use stream as paramter type if type name is fully qualified Cobra Compiler 0.9.6 defect new 2014-07-28T16:12:45Z 2014-07-28 16:12:45 "This code: {{{ def foo(tokens as Cobra.Compiler.IToken*) pass }}} produces this error message: {{{ Cannot find ""IToken*"" at component 3 of qualified type }}} Workarounds include adding a using directive and not using the fully qualified name or creating a type alias such as: {{{ use ICobraToken = Cobra.Compiler.IToken def foo(tokens as ICobraToken*) pass }}} " nerdzero 4 286 Invoke delegate property compiler error Cobra Compiler 0.8.0 Cobra 0.9 defect new 2012-08-02T21:25:21Z 2012-08-02 21:25:57 " {{{ class X var _comparer as Comparison pro comparer from var cue init base.init _comparer = do(a as int, b as int) = a.compareTo(b) def main trace _comparer(5, 4) #works #trace .comparer(5, 4) doesn't compile #error: Cannot call ""comparer"" because it is a ""property"". #Should be equivalent to 'trace .comparer.invoke(5, 4)' #Cobra svn:2758 (post 0.8) / 2012-07-24 on Mono 2.10.9 CLR v4.0.30319 on Mac OS X 10.6.8 }}} " jaegs 5 44 Cobra always allows combining enum values even when not legal Cobra Compiler 0.8.0 defect new 2008-09-24T17:05:55Z 2008-09-24 17:05:55 "Cobra allows enums to be combined (xor'ed) via `EnumName(MemberA, MemberB, MemberC)`. .NET enum types can have an attribute indicating if the enums can be combined. Cobra is not checking for that attribute and reporting an error (or warning?) if it doesn't exist. (I forget the name of the attribute off the top of my head.) " Chuck 5 72 -test with -debug option leaves behind test-*.pdb/.mdb files Cobra Compiler 0.8.0 defect new 2008-11-11T00:05:30Z 2008-11-11 00:05:30 "Using ""cobra -test -debug foo.cobra"" leaves behind extra files like test-200811100322.exe.mdb I saw this on Mono 2.0 with Mac OS X 10.4, but it probably happens on .NET and Windows as well. " Chuck 5 142 problem when using an object variable of nilable generic type Cobra Compiler 0.8.0 defect assigned 2009-01-27T11:01:45Z 2012-09-27 04:09:49 "The following program triggers a runtime assertion, complaining that myT is nil. It is as if the compiler did not realize that T is taking the value int?, and that therefore ""myT"" should be allowed to be nil. {{{ class G var myT as T class Program var g = G() def main is shared p = Program() }}} " jonathandavid 5 157 Check for error: initializer cannot call itself Cobra Compiler 0.8.0 defect new 2009-06-07T03:46:12Z 2009-06-07 03:46:12 "The test case: {{{ class Test cue init .init cue init(i as int) .init(0) def main pass }}} The errors: {{{ x-init-calls-itself.cobra(3): error: Constructor ""Test.Test()"" cannot call itself (C#) x-init-calls-itself.cobra(6): error: Constructor ""Test.Test(int)"" cannot call itself (C#) }}} These errors are dropping through to the C# compiler. Catch them in Cobra. " Chuck 5 180 Optimization: Speed up use of literal collections Cobra Compiler 0.8.0 defect new 2009-10-03T01:45:54Z 2013-06-01 21:03:51 "The program below demonstrates that Cobra's naive handling of something like: {{{ if s in ['a', 'b'], ... }}} is rather slow. This creates a burden on the developer to write lower level code to get better performance. {{{ use System.Diagnostics class P def main reps = 10_000_000 s = 'a' sw = Stopwatch() sw.start for i in reps if s in ['a', 'b', 'c', 'd', 'e', 'f'] s = 'a' sw.stop dur1 = sw.elapsedMilliseconds t = ['a', 'b', 'c', 'd', 'e', 'f'] sw.reset sw.start for i in reps if s in t # if s in List(t) s = 'a' sw.stop dur2 = sw.elapsedMilliseconds ratio = dur1 / dur2 trace dur1, dur2, ratio }}} Output: {{{ trace: dur1=16482 (Int64); dur2=464 (Int64); ratio=35.521551724137931034482758621 (Decimal); at x-literal-list.cobra:27; in P.main" Chuck 5 191 False compilation error with .getType on a generic type Cobra Compiler 0.8.0 defect new 2009-11-17T10:32:53Z 2009-11-17 10:32:53 "The following code gives a false compilation error: {{{ class Program def main .foo(String) .foo(String.getType) .foo(List) .foo(List.getType) # false error def foo(t as Type?) pass }}} The error: {{{ (10): error: For ""foo"" arg 1: The definition for ""List.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. " Chuck 5 224 'use' statements in partial class files dependent on order on compile command line. Cobra Compiler 0.8.0 defect new 2010-07-26T18:52:21Z 2012-12-12 02:25:06 "With partial classes use statements have to be in the first of the class' files to be compiled, rather than in the file that needs the use. See also: http://cobra-language.com/forums/viewtopic.php?f=4&t=644" nevdelap 5 231 all/for in invariant causes COBRA INTERNAL ERROR Cobra Compiler 0.8.0 defect new 2010-08-01T21:04:11Z 2014-01-24 22:37:48 " {{{ class A pass class B var _list as List var _dict as Dictionary invariant all for a in _list get a in _dict.keys }}} # error: COBRA INTERNAL ERROR / InvalidOperationException / Operation is not valid due to the current state of the object " nevdelap 5 232 Small inconsistency in 'if a inherits B' semantics. Cobra Compiler 0.8.0 defect new 2010-08-02T15:37:41Z 2010-09-03 19:14:18 "Once the 'a inherits B' is found to be true and a is allowed to be used as a B it would be nice if it was allowed in subsequent parts of the same expression rather than needing to wait until the next statement. The second and third if statements here are the example. In other words 'if x, if y, do something' should be equivalent to 'if x and y, do something'. I hope I'm being clear enough. {{{ class A pass class B inherits A pass class P var _list as List is shared def main is shared a as A = B() #_list.add(a) No allowed, ok. if a inherits B _list.add(a) # Magically allowed by Cobra. if a inherits B if not _list.contains(a) # Ditto. _list.add(a) if a inherits B and not _list.contains(a) # error _list.add(a) }}} error: Argument 1 of method ""contains"" expects type B?, but the call is supplying type A." nevdelap 5 235 "A numeric literal ending in . such as ""2."" gives a cryptic error message" Cobra Compiler 0.8.0 defect new 2010-08-06T11:30:26Z 2010-08-06 11:30:26 "The expression ""2. * x"" should either work or give a good error message, rather than ""Expecting an expression"". " Chuck 5 241 -test tests runtime with -ert Cobra Compiler 0.8.0 defect new 2010-08-08T19:29:57Z 2010-08-09 11:52:47 "Reproduce: 1. write some code with tests 2. {{{cobra -test code.cobra}}} runs only those tests 3. {{{cobra -test code.cobra -ert}}} also runs 20 Cobra runtime tests, which clog up the output window. Expected: -ert does not change the output of the program. Running the tests but suppressing their output would be fine. Result: Oh no, it's running a bunch of tests I didn't write! Now I have to read a bunch more to find where my errors are!" Kurper 5 244 Cobra gets itself into a state where it puts single quotes around all the strings it is outputting. Cobra Compiler 0.8.0 defect new 2010-08-11T21:36:11Z 2010-08-11 21:36:11 "These is reproducible in my app while running its tests, but I haven't managed to boil it down into something small enough to post to demonstrate the problem. When I manage that I'll add it to the ticket. This mickey mouse little toString, where I'd put a print and a couple of traces... {{{ def toString as String is override and ensure result <> '' body print '--------------' s = _name trace _name, _type if _type <> '' s += ':[_type]' trace s return s }}} Produces this output when running my tests. You'll see that the first three times it is called it prints correctly, then subsequently it is adding lots of extra quotes around everything it is outputing - not just around my _name and _type strings, so it's not that they have garbage in them. {{{ -------------- trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString -------------- trace: _name='abc'; _type=''; at Parameter.cobra:67; in Parameter.toString trace: s='abc'; at Parameter.cobra:70; in Parameter.toString -------------- trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString << test 1: .toString_ol_1_11581 >> test 2: .parse_ol_1_11744 '--------------' trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' '--------------' trace: s='abc'; at Parameter.cobra:77; in Parameter.parse trace: s='zyx:int'; at Parameter.cobra:77; in Parameter.parse '--------------' trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' '--------------' trace: '_name'=''zyx'''; ''_type'=''int'''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''zyx:'int''''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' }}} What triggers it is a line elsewhere also added just for debugging... {{{ print visibility, name, parameters, type }}} in the parse method being tested when the next four calls to it produce the other four outputs, where Visibility is an enum, name and type are strings, and parameters is a list of Parameter, the class with the above toString method. So I'll try to come up with something small that demonstrates the whole problem, which I've been trying to do for while without success so far - but I thought I'd flag it in a ticket, and maybe from this output you might have a inkling." nevdelap 5 256 This code not implementing all interfaces' methods compiles a broken assembly. Cobra Compiler 0.8.0 defect new 2010-09-09T19:58:07Z 2010-10-24 07:25:01 "This code is incorrect because it doesn't implement IEnumerable.getEnumerator but it compiles. {{{ use System.Collections use System.Collections.Generic namespace Test class ReadOnlyList implements IEnumerable, IEnumerable var _list as IList cue init(list as IList) test ints = ReadOnlyList(List(@[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 }}}" nevdelap 5 267 Cobra Enums not support methods of Enum Baseclass Cobra Compiler 0.8.0 defect new 2010-12-06T10:28:56Z 2013-03-29 05:15:36 "The .Net [http://msdn.microsoft.com/en-us/library/system.enum.aspx Enum] baseclass have a few none static methods and a plethora of static methods for obtaining member names and values and doing conversions. Cobra Enums dont recognise these methods. {{{ #!cobra #access to Enum methods via cobra enum class EnumMethods enum Days Mon,Tues,Wed, Thurs, Fri, Sat, Sun enum States has Flags None=0, Invalid=1, Settling=2, Valid =4 def main is shared d = Days.Mon weekend = Days(Sat, Sun) inweekend = d in Set([Days.Sat, Days.Sun]) print '[d] in weekendSet', inweekend #static print Enum.getName(Days, d) print Days.getName(Days, d) # shd work doesnt compile print Enum.getNames(Days) print weekend s = States() print Enum.getNames(States) print Enum.getValues(States) assert s inherits Enum print s.getNames(States) # shd work doesnt compile print s.getValues(States) # shd work doesnt compile print s.hasFlag(States.Invalid) # doesnt compile s = States.Settling s1 = s to Enum # spurious warning print s1.hasFlag(States.Invalid) # cant see hasFlag print s1.typeOf }}} " hopscc 5 306 Unable to insert underscores into some numeric literals Cobra Compiler 0.8.0 defect new 2012-11-07T14:39:26Z 2012-11-07 16:24:04 Decimal portion after period and hex literals could use underscores too. Nefarel 5 333 Implementing ITestRunListener is a little awkward Cobra Compiler 0.9.4 defect new 2013-06-18T13:30:37Z 2013-06-18 13:30:37 "This is nothing major. Just thought I would bring it up. It can be closed as ""won't fix"" and it wouldn't bother me :) I've been playing around with a custom test runner and listener for the MonoDevelop add-in and noticed that the interface suffers from some name collisions. The abstract 'Test' class is in a 'Test' namespace which means the implementing class must qualify the parameter typename as 'Test.Test'. You cannot just 'use Cobra.Core.Test' because then 't as Test' doesn't resolve to the class name. Also, should the methods 'testStarted' and 'testEnded' be accepting 't as ITest' instead? What about 'suiteStarted' and 'suiteEnded'? For reference: http://cobra-language.com/trac/cobra/browser/cobra/trunk/Source/Cobra.Core/Test.cobra" nerdzero 5 359 Confusing interaction between Object? instance and bools Cobra Compiler 0.9.6 defect new 2014-01-31T16:31:02Z 2014-02-01 11:18:42 "reported-by: kobi7 The last assertion in the following program fails {{{ class NilableObjectAsBool def main shouldBeFalse as Object? = false assert shouldBeFalse == false shouldBeTrue = not shouldBeFalse assert shouldBeTrue == true }}} The value of shouldBeTrue actually ends up being 'false'. This is probably because the nilable object has a non-nil value so 'not shouldBeFalse' is returning false. This is confusing when just examining the code especially if the type of the local variable is inferred from a method call that returns an Object?, It also confusing when adding 'assert shouldBeFalse == not shouldBeFalse' to the program and the assertion passes. This may be by design or unfixable in which case this ticket can be closed." nerdzero 5 363 -turbo should default disable -dst (?) Cobra Compiler 0.8.0 defect new 2014-02-10T03:03:17Z 2014-02-10 03:03:17 "-turbo is a catchall for enabling/disabling other options to make a max-speed executable. Theres a comment [http://cobra-language.com/forums/viewtopic.php?f=4&t=17265#p22663 here] suggesting that it should also disable -detailed-stack-trace (though I think that is default off anyway so you would have to have it explicitly specified AND -turbo and make it go away ... ) (It may be preferable to correct -dst code gen so it doesnt cause code gen errors on 'structs')" hopscc 5 366 Compiling the same file twice Cobra Compiler 0.9.6 defect new 2014-03-01T06:17:42Z 2014-03-01 06:17:42 "This: {{{ > cobra foo.cobra foo.cobra }}} Will have Cobra trying to compile the same file twice which leads to confusing errors about duplicate declarations. There should instead be an error that the same file was specified twice, or a warning that the 2nd instance of the file is being ignored. " Charles 5 371 MSBuild Task: error if no assembly references in .cobraproj file Cobra Compiler 0.9.6 defect new 2014-06-29T14:46:50Z 2014-07-04 21:33:26 "On Windows, using ""msbuild.exe"" with a file ""X.cobraproj"" without any assembly references, for example {{{ }}} causes this error message: {{{ ...Cobra.targets(149,3): error MSB6001: Invalid command line switch for ""cobra.bat"". Value cannot be null. [...X.cobraproj] ...Cobra.targets(149,3): error MSB6001: Parameter name: collection [...X.cobraproj] }}} '''Steps to reproduce the failure''': call {{{ msbuild X.cobraproj }}} where ""X.cobraproj"" is this file {{{ Hello Exe }}} and ""Hello.cobra"" is this file: {{{ class Program def main is shared print ""Hello!"" }}} Note: The above ""X.cobraproj"" works with ""xbuild.exe"". With ""msbuild.exe"" it only works with an assembly reference, for example: {{{ ... ... }}} " thriwkin 5 372 "MSBuild Task: a file ""cobra"" in the project directory causes and error on Windows." Cobra Compiler 0.9.6 defect new 2014-06-29T19:25:22Z 2014-06-29 19:56:15 "- On Windows, - running ""msbuild.exe"" or ""xbuild.exe"" fails - with a correct ""X.cobraproj"" and - a file ""cobra"" in the same directory or in a subdirectory ""bin"". {{{ msbuild /t:Rebuild X.cobraproj ==> ...Cobra.targets(149,3): error MSB6003: The specified task executable ""cobra"" could not be run. The specified executable is not a valid application for this OS platform. [...X.cobraproj] }}} {{{ xbuild /t:Rebuild X.cobraproj ==> ...Cobra.targets: error : Error executing tool '...cobra': ApplicationName='...cobra', CommandLine=... CurrentDirectory=... Native error= %1 is not a valid Win32 application. }}} '''Reproduction''': An example of this scenario: The directory ""Source"" of the Cobra compiler source (svn-3116) contains - the ""cobra.cobraproj"" file - and the file ""cobra"", a bash script. A ""Rebuild"" command, given in the Cobra IDE or on the commandline {{{ msbuild /t:Rebuild cobra.cobraproj }}} produces 2 failures: First it fails because the .cobraproj file does not contain any assembly reference -- see ticket:371 After having inserted an assembly reference, it fails because the directory of the ""cobra.cobraproj"" file contains the file ""cobra"". Moving the file ""cobra"" into a subdirectory ""bin"" does not help. After having renamed this file, e.g to ""(cobra)"", all works well. " thriwkin 3 308 cobra internal error: unknown member exception Cobra Compiler 0.8.0 defect Charles assigned 2012-11-15T18:42:03Z 2012-11-25 01:56:55 "version: {{{ The Cobra Programming Language svn:2844 (post 0.9) / 2012-11-14 on .NET CLR v4.0.30319 on Microsoft Windows NT 5.1.2600 Service Pack 3 at C:\Cobra\Cobra-svn-2844\bin\cobra.exe }}} the compilation error: {{{ Error: error: COBRA INTERNAL ERROR / UnknownMemberException / obj=MethodSig-sh(6749, name=LimitReachedHandler, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didStartBindImp=true, didBindImp=true, token=Token(SIG, 'sig', 'sig', ln 36, col 2, H:\projects\generic_project\ManageProfiling.cobra), didBindInh=true, isGeneric=false, isGenericDef=false, needsConstruction=false, genericDef=nil, baseClass=Class-mi(1031, name=MulticastDelegate, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, token=Token.empty, didBindInh=true, isGeneric=false, isGenericDef=false, needsConstruction=false, 1031), nativeType=nil, baseNode=LibraryTypeProxy-mi(6748, didBindInh=false, didBindInt=false, didBindImp=false), 6749), name='IsPublic', type=MethodSig (generic_project) }}} okay, the code that triggered it is perhaps kinda tricky. I have a mixin with a shared (static) event. (basically notifying when would be a good time to do a potentially heavy operation) and the adding part, registers a listen with a method, in the 'cue init' part, if the right option flag is set. the problem may come from the event signature, which is empty. here's some code: {{{ mixin ManageProfiling sig LimitReachedHandler event reachedLimit as LimitReachedHandler is shared class Controller adds ManageProfiling cue init(view as IView, options as Options) base.init _opts = options .attachView(view) if Options.Profile in _opts listen ManageProfiling.reachedLimit, ref .doSaveState def doSaveState pass }}} Thanks for all the work!" kobi7 3 243 Invariants called too many times and in wrong order Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-09T22:53:39Z 2013-07-08 17:35:22 " {{{ class A cue init base.init print 'inside init of A' def m1 as bool print 'inside invariant of A' return true invariant .m1 class B inherits A cue init base.init print 'inside init of B' def m2 as bool print 'inside invariant of B' return true invariant .m2 class P def main is shared B() }}} '''Actual result''' {{{ inside init of A (1) inside invariant of A (2) inside init of B inside invariant of A inside invariant of A (3) inside invariant of B }}} (1) At the end of the base class constructor the object is not yet constructed and it's invariant need not hold and shouldn't be called. (2) Additionally if the invariant is called at that point and includes calls to any methods overridden in the derived class they can fail because it hasn't constructed yet and its state is not ready to be used. (3) Extra test of A's invariant just not needed. I guess it's because I've used calls to methods to show when it's in the invariants, but again, the object is not finished constructing so it need not call the invariant on the exit of that method. (It's finished constructing after the invariant check at the end of the most derived init, not before, so at any time before that, method calls, or whatever used in the init, the invariant shouldn't be called yet.) '''Expected result''' {{{ inside init of A inside init of B inside invariant of A inside invariant of B }}} BTW: you can hit me up in chat to discuss, instead of us bouncing replies back and forth here. More productive, yeah? Cheers. nevdelap(at)gmail(dot)com for *both* gmail chat & MSN, or nevdelap in yahoo." nevdelap 3 262 Cobra needs support 'implements' and overloads on properties Cobra Compiler 0.8.0 defect Chuck assigned 2010-10-24T08:28:39Z 2010-11-28 08:10:25 "Currently cobra supports overloads and specifying 'implements' (for describing that a method provides an implementation of an interface method) on methods but it is not yet provided on properties. It needs to be because this lack of implementation makes providing a manual 'raw' implementation of an IEnumerator (for a generic) impossible(*)[[BR]] [[BR]] since that interface requires properties defining both .current as [[BR]] and .current as Object[[BR]] Heres a minimal impl for a simple generic range enumerator showing the issue. {{{ # very simple Generic Enumerable implementation class Ranger implements IEnumerable var _start as T var _stop as T cue init(start as T, endSent as T) base.init _start = start _stop = endSent def getEnumerator as IEnumerator return RangeEnumerator(_start, _stop) def getEnumerator as System.Collections.IEnumerator implements System.Collections.IEnumerable return .getEnumerator class RangeEnumerator implements IEnumerator var _first = false var _start as T var _stop as T var _currVal as T cue init(start as T, stopVal as T) base.init _start = start _stop = stopVal _first = true def hasMoreElements as bool return _currVal <> _stop def nextElement _currVal += 1 # # For IEnumerator # def dispose pass def reset _currVal = _start _first = true def moveNext as bool if not _first .nextElement _first = false if .hasMoreElements return true return false get current as T return _currVal #get current as Object # return _currVal # # return .current class Test def main is shared for i in Ranger(1,10) print i }}} As is it emits a diagnostic (as expected/desired) {{{ c:\home\hops\src\cobra\Tst\simpleGenericEnum.cobra(18): error: ""RangeEnumerator"" does not implement interface member ""System.Collections.IEnumerator.Current"". ""RangeEnumerator.Current"" is either static, not public, or has the wrong return type. (C#) warning: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error) (C#) c:\home\hops\src\cobra\Tst\simpleEnum.cobra(56): warning: (Location of symbol related to previous error) (C#) Compilation failed - 1 error, 2 warnings }}} If the second 'get current as Object' is uncommented it still emits a diagnostic regarding duplicated property names {{{ simpleGenericEnum.cobra(59,6): error: There is already another class member with the name ""current"". Compilation failed - 1 error, 0 warnings }}} (*) A 'raw' implementation provides the interface itself rather than deferring it to a embedded class or using a generator. This defect only marked as major rather than critical or higher since most Enumerators can be provided as a generator (using yield). This is not immediately obvious if someone attempts an implementation in the above fashion... " hopscc 3 271 Get compile error when using anonymous method with delegate(sig) Cobra Compiler 0.8.0 defect Chuck assigned 2011-01-15T22:03:11Z 2011-01-16 12:17:54 "When I attempt to compile the code attached which uses a sig/delegate and an anonymous method, I get the following compile error: error: COBRA INTERNAL ERROR / ArgumentOutOfRangeException / Index was out of range. Must be non-negative and less than the size of the collection.; Parameter name: index Compilation failed - 1 error, 0 warnings Not running due to errors above." torial 3 152 "Automatic library referencing from ""use"" does not always work" Cobra Compiler 0.8.0 Cobra 0.9 defect Chuck assigned 2009-02-24T05:32:52Z 2013-05-05 03:01:04 "The following program gives an error if you comment out the ""args"" directive: {{{ #!python use System.Windows.Forms use System.Drawing %% args -ref:System.Drawing class Program def main is shared print Color.red }}} * error: The type or namespace name ""Color"" does not exist in the namespace ""System.Drawing"" (are you missing an assembly reference?) I believe the problem is that * ""use System.Windows.Forms"" automatically refs System.Drawing * then ""use System.Drawing"" doesn't fault the System.Drawing.dll reference in * so Cobra fails to pass an /r: onto C#. See also: [http://cobra-language.com/forums/viewtopic.php?f=4&t=304#p1808 discussion] " Chuck 4 239 -out: does not affect -test Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-08T17:42:00Z 2014-02-28 11:33:28 "Steps to reproduce: 1. Create directory, add this file to it: {{{ # Specific DLLs shouldn't matter, just use something defined in em @ref ""bin/Lidgren.Network.dll"" use Lidgren.Network class Program def main test pass body # Do something that needs the DLL. NetPeerConfiguration(""MyExampleName"") }}} 2. Create bin/ directory in it, copy Lidgren.Network.dll into it (should work with any DLL, with test case changed appropriately) 3. ""cobra test.cobra -out:bin/"" works as expected 4. ""cobra test.cobra -out:bin/ -test"" fails with {{{ Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToken=nul l' or one of its dependencies. The system cannot find the file specified. File name: 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToke n=null' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boo lean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, E vidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Bool ean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Cobra.Lang.Test.TestRunner._collectTestsFor(Assembly ass, Boolean willFoll owReferences, Set`1 found) at Cobra.Lang.Test.TestRunner.CollectTestsFor(Assembly ass, Boolean willFollo wReferences) at Cobra.Lang.Test.TestRunner.RunTestsFor(Assembly ass, Boolean willFollowRef erences) at Cobra.Lang.Test.TestRunner.RunAllTests() at Cobra.Lang.CobraCore.RunAllTests() at _GeneratedTestRunner.Main() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. }}}" Kurper 4 283 Parser error regarding multi-line collection literals Cobra Compiler 0.8.0 defect Chuck assigned 2012-07-01T22:09:01Z 2013-05-12 15:06:30 "The following program produces a false error from the parser: {{{ #!cobra class A var t = [ 0, 1, 3 ] var obj as Object def main pass }}} x-parser-problem.cobra(7,1): error: Expecting use, assembly, namespace, class, interface or enum, but got ""var"". It doesn't matter if the literal is a list or array. Until there is a fix, the workaround is to put the closing bracket (`]`) on the same level as the starting `var`. " Charles 5 2 "Cannot use ""x in someList"" where x is dynamic?" component1 defect Chuck accepted 2008-03-16T21:42:02Z 2008-03-16 21:44:23 "class X def main is shared x = 2 to dynamic? assert (x to int) in [1, 2, 3] # works assert x in [1, 2, 3] # error: Cannot convert type ""int?"" to ""int"" " Chuck.Esterbrook 5 41 False warning for if statement on box var Cobra Compiler 0.8.0 defect Chuck accepted 2008-09-03T19:01:34Z 2008-09-14 06:34:12 "{{{ class X def main is shared x = X() x.compute var _foo as X? def compute if _foo .bar if _foo # false warning here since .bar can change _foo .bar def bar _foo = nil }}} The warning is: foo.cobra(12): warning: The expression ""_foo"" (of type ""X"") will always evaluate to true because it is not nilable. You can remove the expression. This is low priority as it comes up rarely." Chuck 5 204 Infer correct types for lambdas and anon methods Cobra Compiler 0.8.0 defect Chuck assigned 2010-06-14T10:28:04Z 2010-06-14 11:01:44 "Lambdas and anon methods/closures should have their types inferred correctly as method sigs not ""dynamic"" and anon method return type respectively. Probably should be a follow on from patch for ticket:39 using same method sig search and matching." hopscc 5 210 Spaces after tabs should be allowed for implicit as well as explicit line continuation. Cobra Compiler 0.8.0 defect Chuck assigned 2010-07-04T14:03:47Z 2013-05-05 09:04:44 "Space after tabs is not allowed in implicit line continuation and so currently requires the workaround of using explicit line continuation for vertical alignment where it needn't be. Test case: (Note: code doesn't display as intended here. Ok copied to editor with tabs=4) {{{ class X def foo(i as int, j as int) as int return i + j def main trace .foo(1, 2) trace .foo(1, 2) trace .foo(1, 2) }}} {{{ test.cobra(11): error: test.cobra(11,1): error: Cannot mix tabs and spaces in indentation. [TAB][TAB][TAB][TAB][SPACE][SPACE][SPACE]... }}} " nevdelap 5 236 Specifying -test and -compile-if-needed gets ArgumentOutOfRangeException. Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-07T23:44:36Z 2010-09-04 13:28:32 " {{{ class P def main is shared test assert false body print 'hello' }}} {{{ nev@bananinha:~/Temp/cobra$ cobra -test -compile-if-needed test.cobra An unhandled exception has occurred. Cobra debugging tips: To get file name and line number information for the stack frames, use: cobra -debug foo.cobra If running the executable through ""mono"" then also use --debug (double dash): mono --debug foo.exe ... To get a post-mortem, HTML-formatted report with more details about your objects: cobra -debug -exception-report foo.cobra For even more information, try: cobra -debug -exception-report -detailed-stack-trace foo.cobra Or use the abbreviations: cobra -d -er -dst foo.cobra Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of range. Parameter name: index at System.Collections.Generic.List`1[Module].get_Item (Int32 index) [0x00000] at Cobra.Lang_ert_b6e375e3164366f1086afa629ec24c88.Extend_IList__T__ExtendList.Last[Module] (IList`1 _lh_this) [0x00000] at Compiler.ComputeOutNameSharp () [0x00000] at ClrBackEnd.ComputeOutName () [0x00000] at Compiler.CompileFilesNamed (IList`1 paths, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] at CommandLine.DoTest (System.Collections.Generic.List`1 paths) [0x00000] at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] at CommandLine.Run () [0x00000] at CobraMain.Main () [0x00000] }}} " nevdelap 3 130 "The compiler doesn't find the ""closest"" extension method" Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid accepted 2009-01-08T02:10:02Z 2009-03-08 05:48:16 "Test case: {{{ # x-extend.cobra class A pass class B inherits A pass class C inherits B pass extend B def n as int return 2 extend C def n as int return 3 class P def main is shared b = B() assert b.n == 2 c = C() assert c.n == 3 }}} Cobra takes the first extension method it can find instead of the closest among all available. Also, this bug is blocking further extensions being added to Cobra.Lang\ExtendIEnumerable.cobra " Chuck 3 153 Regression test problems re tests with CultureInfo assumptions Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid assigned 2009-02-24T05:47:55Z 2013-05-06 01:11:26 "Reported by jonathandavid: About the failing tests: So far I've been able to fix the following ones: (29) 062-string-substitution.cobra (85) 120-primitive-type-members.cobra (101) 310-primitive-members.cobra (133) 510-number-parse.cobra (267) 100-number-float32.cobra (269) 100-number-float64.cobra (273) 106-number-decimal.cobra I've fixed all of them by adding CultureInfo?.invariantCulture when calling toString or parse. Otherwise, my locale turned ""3.2"" into ""3,2"", which wasn't expected by the tests. I encountered my first problem with test ""(130) 504-sharp-error.cobra"". This test assumes that the C# will produce error messages in English, which is not the case in my installation. A similar thing happens with ""(445) 500-cannot-infer.cobra"", and with ""520-debug.cobra"". I think we can relax these tests a little bit so that they don't look for specific messages, but rather for things that won't change on a non-English locale. For example, instead of looking for a warning that contains ""related to"", we can look for a warning that contains simply the line that causes the warning ""(3)"". If you want I can perform these modifications, and once all tests pass in my installation, create a patch and submit it here. A different kind of problems occurs with ""(639) 410-use-lowernames-dll.cobra"". This took me a while to figure out. Apparently, the test is referencing a lowernames.dll file that should be in the current path. Instead, there is a lowernames.cs file. I got the test to pass by manually compiling this .cs file, which generates the necessary dll, but this is not done automatically when I install from source and run -testify. I don't know how to solve this problem, can you help me? Also, there seems to be a minor issue with the testify script itself. When a test fails, the test count is incremented twice, and the test name is written twice. For example: ... (taken from ticket:146) " Chuck 4 146 bug when adding an extension method that is an overload of a BCL class Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid assigned 2009-02-06T08:00:41Z 2009-02-24 05:50:13 "Consider: {{{ extend String def split(chars as char*) as List return ['dummy'] class Foo def main is shared print 'a:b'.split(@[c':']) # Prints ['dummy'] }}} When the main method is executed, it looks as if the compiler is generating a call to my split(char*) extension method. This is wrong, because there is also a split(char[]) method in String that matches exactly the argument I'm passing. I think the problem only occurs when adding an extension overload to a BCL class because the problem does not show up when I try to reproduce it using a class written in Cobra: {{{ class Foo def bar(x as int[]) pass extend Foo def bar(x as int*) .bar(List(x).toArray) class Baz def main is shared Foo().bar(@[1, 2]) # correctly calls array version }}} " jonathandavid 5 141 Cannot effectively put more options after -turbo Cobra Compiler 0.8.0 defect nerdzero assigned 2009-01-27T00:50:33Z 2014-02-12 19:16:41 "This command line will still exclude assert statements: {{{ cobra -turbo -include-asserts:yes foo.cobra }}} " Chuck 4 233 Weird COBRA INTERNAL ERROR printing event args (Gtk) Cobra Compiler 0.8.0 defect nevdelap assigned 2010-08-03T00:11:47Z 2010-09-03 19:11:35 " {{{ @args -pkg:gtk-sharp-2.0 use Gtk class P def main is shared pass def onKeyPressEvent(o, args as KeyPressEventArgs) print args.event.key # error caused by this }}} error: COBRA INTERNAL ERROR / ArgumentException / An element with the same key already exists in the dictionary." nevdelap 4 247 init for base class called before preconditions on derived class init are tested & compile not protecting it's calls to toString Cobra Compiler 0.8.0 defect nevdelap assigned 2010-08-14T04:23:16Z 2013-04-01 08:06:05 "This shows that that's the case. {{{ class A cue init base.init throw Exception() # Something fails class B inherits A var _s as String cue init(s as String) require s <> 'a' # This should have failed first. body base.init _s = s def toString as String is override return _s class P def main is shared print B('a') }}} '''Expected result:''' Unhandled Exception: Cobra.Lang.RequireException: blaa '''Actual result:''' Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown. '''This shows up this further problem.''' {{{ class A cue init base.init # The difference is it's now throwing here. class B inherits A var _s as String cue init(s as String) require s <> 'a' body base.init _s = s def toString as String is override return _s class P def main is shared print B('a') }}} '''Expected result:''' Same as above. '''Actual result:''' It should never have started constructing, but since it has the compiler stringifies the object to print diagnostics, and since the object hasn't finished constructing and isn't ready to have it's methods called, we get this... {{{ Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Cobra.Lang.CobraImp.ToTechString (System.Object x) [0x00000] at Cobra.Lang.CobraCore.ToTechString (System.Object x) [0x00000] at Cobra.Lang.SourceSite.ToString () [0x00000] at Cobra.Lang.StringMaker.ObjectToString (System.Object obj) [0x00000] at Cobra.Lang.StringMaker._makeString (System.Object x) [0x00000] at Cobra.Lang.StringMaker.MakeString (System.Object x) [0x00000] at (wrapper synchronized) Cobra.Lang.StringMaker:MakeString (object) at Cobra.Lang.AssertException.get_Message () [0x00000] at System.Exception.ToString () [0x00000] }}} So the second problem is that when the compiler is putting out diagnostics it should have a catch around stringifying objects so that if the toString throws it can keep going and produce meaningful output, and maybe replace the name with something, I don't know what. In this cause if it replaced it with 'BOOM!' (just for sake of this example) it would produce this, instead of the above. {{{ Unhandled Exception: Cobra.Lang.RequireException: sourceSite = /home/nev/Temp/cobra/test.cobra:12 in B.cue.init for object BOOM! info = nil this = BOOM! (s <> 'a') = false s = 'a' at B..ctor (System.String s) [0x00000] at P.Main () [0x00000] }}} " nevdelap