No one can accurately predict the economy of a country that far in the future.
Also if Iran integrates into the world economy it will go through an economic boom the likes of which hasn’t been seen. You are forgetting that 80MM population has been completely closed off to US investment and significantly closed off to EU investment.
So Iran could pass Turkey in next 20 years if sanctions are lifted and ties with US are normalized.
You are overestimating the role of foreign investments....If larger amount of foreign investments were made in Iran, its economy would be 5-10% larger than it is today.... and still smaller than Turkish.
Iran was open to foreign investments but most investments came into oil sector. Stock of Iran's foreign investment at home is 50bln$. Turkish stock of foreign investment is 180bln$....If you want to attract more foreign investments you need to make institutional reforms to create good environment for foreign investors---simply relieving sanctions is not enough.
Of course because of sanctions Iran lagged behind Turkey....2 shortages:
1) It is normal for countries to borrow money in international financial markets and invest that money into domestic economy.....
Iran was banned from international financial markets and could not borrow cheaply.
In contrast, having access to international financial markets, Turkish companies borrowed a lot of money and invested into their economy---Turkish external debt (corporate +government) is 452bln$---50% of Turkish nominal GDP.
Iran however could not borrow and its external debt is small---7bln$ only----or 1,5% of GDP---so potentially there is a lot of room to grow.
Because Iranian debt is so small -
-there is a lot of room to grow when sanctions are relieved----- Iranian companies and government can potentially borrow
hundreds of billions of dollars and make investments into Iranian economy thus boosting economic growth.
2) There is a potential to attracting more foreign investments.
But even despite all this, Iranian economy is overall less dynamic than Turkish because of geographic reasons.
Regarding "No one can accurately predict the economy of a country that far in the future."
Of course it is impossible to accurately estimate future GDP over the next 30 years...but accuracy doesn't matter---what is important is overall picture of the future.
Economists at PwC analyzed each country and provided their overall view of how world will look like in 2050. I myself don't agree with some of their estimates (for example I doubt long-term success of Saudi Arabia--a country whose economy is fully built on oil).....but overall balance of power seems realistic.
This is an overall picture of the future.
Most countries that are higher on the list than Iran will have economies that will be 1,1-2,5 times bigger than Iranian economy----
this is not a substantial superiority and these countries will not be able to threaten Iran.
However 3 countries will have substantial superiority over Iran....
USA will have a GDP which is 8,5 timers bigger than Iran's and China will have a GDP that is 14,5 times bigger than Iran---------so these countries will potentially be big enough to threaten Iran.
But China and USA are far away located and China will be contained by an alliance of Japan+Korea+Taiwan+Vietnam+USA....And US will be busy containing China like it contained USSR in the past.
However India is an immediate neighbor of Iran and will have a GDP that is 11 times bigger than Iran's---so India is a potential long-term threat to Iran.
We can assume that in the future India will build a huge Navy and air force and will become a hyperpower that projects power through the area and tries to establish hegemony in the Indian Ocean basin.
So while China and USA are far away located and will be busy containing each other....India will become a threat not only to Pakistan but also to Iran and other counties of the region.
So probably a military block of Iran+Pakistan+China designed to contain India will appear .