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

Grain seems to treat a type as a different type when the module "as" functionality is used when importing its module #2211

Open
godotdot opened this issue Nov 26, 2024 · 0 comments

Comments

@godotdot
Copy link

The following code (also implemented in this attachment:
bad_module_example.zip) exhibits the following behavior:

grain main.gr 
File "main.gr", line 9, characters 10-20:
Error: This expression has type DifferentName.Type
       but an expression was expected of type TypeProvider.Type
TypeProvider::Type is abstract because no corresponding cmi file was found in path.

I would expect DifferentName.Type and TypeProvider.Type would be treated as the same type, as DifferentName.Type is just an alias/renaming of TypeProvider.Type.

There are similarities between this issue and #1758.

main.gr

module Main    
    
from "./type_provider.gr" include TypeProvider as DifferentName    
use DifferentName.{ type Type }    
                                  
from "./function_provider.gr" include FunctionProvider    
use FunctionProvider.{ function }    
    
function( {field: 5} )

type_provider.gr

module TypeProvider

provide record Type {
    field: Number
}

function_provider.gr

module FunctionProvider    
    
from "./type_provider.gr" include TypeProvider     
use TypeProvider.{ type Type }     
    
provide let function = (t: Type) => {    
    void    
}    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants