Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

[BUG] Using a param __getattr__() breaks __setattr__() #3341

Open
helehex opened this issue Jul 31, 2024 · 1 comment
Open

[BUG] Using a param __getattr__() breaks __setattr__() #3341

helehex opened this issue Jul 31, 2024 · 1 comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@helehex
Copy link
Contributor

helehex commented Jul 31, 2024

Bug description

When you declare __getattr__[]() with a parametric key, then using __setattr__() for that same type will give:

error: invalid call to 'setattr': missing 1 required positional argument: 'key'

Steps to reproduce

@value
struct MyType:
    fn __getattr__[key: StringLiteral](self) -> Int:
        return 0
    
    fn __setattr__(inout self, key: StringLiteral, value: Int):
        pass


fn main():
    var t = MyType()
    t.a = 1

System information

Host Information
  ================

  Target Triple: x86_64-unknown-linux
  CPU: skylake
  CPU Features: adx, aes, avx, avx2, bmi, bmi2, clflushopt, cmov, crc32, cx16, cx8, f16c, fma, fsgsbase, fxsr, invpcid, lzcnt, mmx, movbe, pclmul, popcnt, prfchw, rdrnd, rdseed, sahf, sgx, sse, sse2, sse3, sse4.1, sse4.2, ssse3, x87, xsave, xsavec, xsaveopt, xsaves

mojo 2024.7.3108 (ca019713)

modular 0.8.0 (39a426b5)
@helehex helehex added bug Something isn't working mojo-repo Tag all issues with this label labels Jul 31, 2024
@helehex
Copy link
Contributor Author

helehex commented Jul 31, 2024

Regardless of whether or not the __setattr__() is parametric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant