Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 56 - Type constraints for Ints do not allow for integer comparison. - haxe #56

Closed
issuesbot opened this issue May 28, 2013 · 1 comment

Comments

@issuesbot
Copy link

[Google Issue #56 : https://code.google.com/p/haxe/issues/detail?id=56]
by jdonald...@gmail.com, at 04/02/2010, 14:48:46
What steps will reproduce the problem?
Type constraints allow comparisons for Floats, but not for Ints. The code
at the bottom will work if it is rewritten as:

class Test<T:Float>{...}

but does not work as is.

What is the expected output? What do you see instead?
I thought this should compile properly. Instead, this is the error:
> return this.x > x;
src/Test.hx:8: characters 9-19 : Cannot compare Test.T and Test.T

Please complete the following class with minimal code reproducing the
problem :

class Test<T:Int>{
    private var x:T;
    public function new(x:T){
        this.x = x;
        }
    public function compare(x:T){
        return this.x > x;
        }
    public static function main(): Void
    {
        var f = new Test<Int>(5);
        }
    }

Please provide any additional information below.

@issuesbot
Copy link
Author

[comment from ncanna...@gmail.com, published at 23/07/2010, 17:17:51]
Fixed on SVN, thanks for reporting.

Simn added a commit that referenced this issue Feb 8, 2024
* [tests] add tests for indexOf/lastIndexOf

* [python] make indexOf and lastIndexOf ecma compliant when str is empty

* [php] fix indexOf and lastIndexOf if search string is ""

* [neko] fix indexOf and lastIndexOf if search string is ""

* [cs] fix indexOf and lastIndexOf if search string is ""

* [lua] conform to String.indexOf spec (#56)

* [python] don't inline StringImpl#lastIndexOf/#indexOf (#55)

Because their method body is quite big.

* fix merge mishap

* fix JVM, ignore flash

* fix

* dodge lua

---------

Co-authored-by: frabbit <frabbit77@googlemail.com>
Co-authored-by: Justin Donaldson <jdonaldson@gmail.com>
Co-authored-by: Sebastian Thomschke <sebthom@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant