ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.66k stars 750 forks source link

[Bug]: `cannot resolve module` compilation errors when moving from update 8 to another version #41338

Open Nadeeshan96 opened 1 year ago

Nadeeshan96 commented 1 year ago

Description

$title

Steps to Reproduce

% bal new hello
Created new package 'hello' at /Users/nadeeshand/hello.

% cd hello 

% bal run
Compiling source
        nadeeshand/hello:0.1.0

Running executable

Hello, World!

% bal -v
Ballerina 2201.8.0 (Swan Lake Update 8)
Language specification 2023R1
Update Tool 1.3.15

% bal dist use 2201.7.2
'2201.7.2' successfully set as the active distribution

% bal -v               
Ballerina 2201.7.2 (Swan Lake Update 7)
Language specification 2023R1
Update Tool 1.3.15

% bal run 
Compiling source
        nadeeshand/hello:0.1.0
ERROR [main.bal:(1:1,1:21)] cannot resolve module 'ballerina/io'
ERROR [main.bal:(4:5,4:32)] undefined function 'println'
ERROR [main.bal:(4:5,4:32)] undefined module 'io'
error: compilation contains errors

When Dependencies.toml is removed and bal run is run again, this compiles successfully. It seems better to provide a message to do that.

Affected Version(s)

2201.8.0. test pack

OS, DB, other environment details and versions

MacOS 13.2.1

Related area

-> Update Tool

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Nadeeshan96 commented 1 year ago

Discussed better to add the reason as a FAQ or as a Stack Overflow question.

Nadeeshan96 commented 1 year ago

Discussed better to add the reason as a FAQ or as a Stack Overflow question.

Created https://stackoverflow.com/questions/77351869/cannot-resolve-module-compilation-errors-after-downgrading-the-ballerina-versi.